Xcode 15 (iOS17) 打包的项目在iOS 12系统上启动崩溃

使用Xcode15打包的项目在iOS12上启动崩溃,与新的链接器有关。解决方法包括将最低部署目标提升至iOS15,移除SwiftUI支持或在Release环境中添加`-Wl,-ld_classic`。官方建议针对旧版本系统使用经典链接器或调整目标版本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

用xcode 15打包出来的项目在iOS 12 的系统上启动就崩溃,并且是在进入appdelegate 之前的编译阶段就崩溃了

1、Build Settings -> Other Linker Flags -> Add -> -ld64

其中“-ld64”可以有三个值“-Wl、-ld_classic、-ld64” 理论上需要设置 “-ld64”即可

附上官方社区回复:

“New Features

A new linker has been written to significantly speed up static linking. It’s the default for all macOS, iOS, tvOS and visionOS binaries and anyone using the “Mergeable Libraries” feature. The classic linker can still be explicitly requested using -ld64, and will be removed in a future release.
 (108915312)

Known Issues

Binaries using symbols with a weak definition crash at runtime on iOS 14/macOS 12 or older. This impacts primarily C++ projects due to their extensive use of weak symbols. (114813650) (FB13097713)

Workaround: Bump the minimum deployment target to iOS 15, macOS 12, watchOS 8 or tvOS 15, or add -Wl,-ld_classic to the OTHER_LDFLAGS build setting.”

2、当这个时候设置之后,当debug 环境可以正常时候,切换到release 环境会继续崩溃,虽然报错是汇编代码,但是很明显是和之前的不一样

需要处理:Build Settings ->Asset Catalog Compiler-> Generate Swift Asset Symbol Framework Support,把SwiftUI去掉,(iOS 12 是还不支持 swiftUI 的,当时的UI框架应该是UIKit 和storyboard)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值