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

用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)

猜你喜欢

转载自blog.csdn.net/qq_42924450/article/details/134859762