TestFlight 安装的应用程序因 Swift 程序包管理器依赖项而崩溃
TestFlight installed app crash with Swift Package Manager dependencies
我们已经迁移了一些 CocoaPod 依赖项,以便在 Xcode11 中构建并与 Swift 包管理器链接。但是,每当我们将应用程序提交到 AppStore Connect 并使用 TestFlight 分发时,应用程序当它尝试使用 SPM 链接依赖项之一的 API 时崩溃。其他构建(临时和开发)工作正常。一些 SPM 依赖项也链接了 2 个应用程序扩展。
有没有人遇到过这个问题,你知道这是什么问题吗and/or如何解决?
正在附加崩溃的堆栈跟踪。这发生在 ObjectMapper
依赖项中。
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x00000000800000d0
Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [19562]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 OurAwesomeApp 0x0000000101693d14 nominal type descriptor for EnumTransform + 0
1 OurAwesomeApp 0x000000010108cda0 <- infix<A>(_:_:) + 612 (__hidden#1488_:38)
2 OurAwesomeApp 0x0000000101074434 <- infix<A>(_:_:) + 100 (__hidden#434_:36)
3 OurAwesomeApp 0x0000000100cad360 TWSplitParticipant.mapping(map:) + 1388 (DataClasses.swift:1211)
4 OurAwesomeApp 0x00000001010842cc Mapper.map(JSON:) + 1224 (__hidden#1191_:106)
5 OurAwesomeApp 0x0000000101087c70 _hidden#1144_ + 24 (__hidden#110_:0)
6 libswiftCore.dylib 0x000000018f3cd61c $sSTsE10compactMapySayqd__Gqd__Sg7ElementQzKXEKlF + 732 (SequenceAlgorithms.swift:807)
7 OurAwesomeApp 0x0000000101084a68 Mapper.mapArray(JSONArray:) + 212 (__hidden#1191_:166)
8 OurAwesomeApp 0x0000000101082a8c Mapper.mapArray(JSONObject:) + 192 (__hidden#1191_:156)
9 OurAwesomeApp 0x00000001010753d4 _hidden#461_ + 148 (__hidden#487_:92)
10 OurAwesomeApp 0x0000000101088c8c _hidden#1301_ + 196
11 OurAwesomeApp 0x0000000100cac720 TWSplitRequest.mapping(map:) + 812 (DataClasses.swift:1157)
12 OurAwesomeApp 0x00000001010842cc Mapper.map(JSON:) + 1224 (__hidden#1191_:106)
13 OurAwesomeApp 0x0000000101082988 Mapper.map(JSONObject:) + 160 (__hidden#1191_:89)
14 OurAwesomeApp 0x00000001010752f0 _hidden#459_ + 644 (__hidden#487_:66)
15 OurAwesomeApp 0x000000010108896c <- infix<A>(_:_:) + 152 (__hidden#1307_:116)
16 OurAwesomeApp 0x0000000100ca7248 TWInvoice.mapping(map:) + 4000 (DataClasses.swift:377)
17 OurAwesomeApp 0x00000001010842cc Mapper.map(JSON:) + 1224 (__hidden#1191_:106)
18 OurAwesomeApp 0x0000000101087c70 _hidden#1144_ + 24 (__hidden#110_:0)
19 libswiftCore.dylib 0x000000018f3cd61c $sSTsE10compactMapySayqd__Gqd__Sg7ElementQzKXEKlF + 732 (SequenceAlgorithms.swift:807)
20 OurAwesomeApp 0x0000000101084a68 Mapper.mapArray(JSONArray:) + 212 (__hidden#1191_:166)
21 OurAwesomeApp 0x0000000101082a8c Mapper.mapArray(JSONObject:) + 192 (__hidden#1191_:156)
22 OurAwesomeApp 0x00000001010753d4 _hidden#461_ + 148 (__hidden#487_:92)
23 OurAwesomeApp 0x0000000101088c8c _hidden#1301_ + 196
24 OurAwesomeApp 0x0000000100ca5b88 TWInvoicesByType.mapping(map:) + 328 (DataClasses.swift:266)
25 OurAwesomeApp 0x00000001010842cc Mapper.map(JSON:) + 1224 (__hidden#1191_:106)
26 OurAwesomeApp 0x0000000101082988 Mapper.map(JSONObject:) + 160 (__hidden#1191_:89)
27 OurAwesomeApp 0x00000001010752f0 _hidden#459_ + 644 (__hidden#487_:66)
28 OurAwesomeApp 0x000000010108896c <- infix<A>(_:_:) + 152 (__hidden#1307_:116)
29 OurAwesomeApp 0x0000000100ca3adc TWAccount.mapping(map:) + 104 (DataClasses.swift:81)
30 OurAwesomeApp 0x00000001010842cc Mapper.map(JSON:) + 1224 (__hidden#1191_:106)
31 OurAwesomeApp 0x0000000101082988 Mapper.map(JSONObject:) + 160 (__hidden#1191_:89)
32 OurAwesomeApp 0x0000000100c47c18 closure #1 in DataServer.getAccountInfo(_:) + 492 (DataServer.swift:949)
33 OurAwesomeApp 0x00000001011d7888 _hidden#2846_ + 164
34 OurAwesomeApp 0x00000001011db76c _hidden#2893_ + 52 (__hidden#578_:0)
35 OurAwesomeApp 0x00000001011b55e0 _hidden#996_ + 28 (__hidden#578_:0)
36 libdispatch.dylib 0x0000000181e29610 _dispatch_call_block_and_release + 24 (init.c:1408)
37 libdispatch.dylib 0x0000000181e2a184 _dispatch_client_callout + 16 (object.m:495)
38 libdispatch.dylib 0x0000000181e0d35c _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 996 (inline_internal.h:2487)
39 CoreFoundation 0x00000001820da3c4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1749)
40 CoreFoundation 0x00000001820d53b8 __CFRunLoopRun + 2004 (CFRunLoop.c:3069)
41 CoreFoundation 0x00000001820d48bc CFRunLoopRunSpecific + 464 (CFRunLoop.c:3192)
42 GraphicsServices 0x000000018bf40328 GSEventRunModal + 104 (GSEvent.c:2246)
43 UIKitCore 0x000000018616a6d4 UIApplicationMain + 1936 (UIApplication.m:4753)
44 OurAwesomeApp 0x0000000100c1048c main + 68 (OurAwesomeFactoryFactory.swift:25)
45 libdyld.dylib 0x0000000181f5f460 start + 4
2019-11-27更新
在 related Swift bug post 中,有人找到了解决方法:
Setting DEAD_CODE_STRIPPING = NO in our app’s target fixes the crash.
原post
首先,是SPM的编译问题。只需回滚到 CocoaPods。
直到 Xcode 11.2.1,苹果还没有修复这个问题。
删除所有派生文件,清理项目。然后使用 release
配置尝试 运行 您的项目。现在您应该能够重现崩溃了。
我在一个 iOS 项目中使用了两个名为 Moya
和 Parchment
的库,以及从 CocoaPods 迁移而来的 Swift 包管理器。当执行引用这两个库的逻辑时,从 TestFlight 下载的应用程序崩溃。
而且崩溃日志看起来完全是胡说八道,指向一个方法的方法描述符的内存对齐问题。
Apple 在Xcode 发行说明中提到了一个已知问题,不知道是否相关:
If an iOS, tvOS, or watchOS app uses a Swift Package that builds a dynamic library, it cannot be submitted to the App Store. (55564324)
Workaround: Modify the Package manifest to build a static library.
我们已经迁移了一些 CocoaPod 依赖项,以便在 Xcode11 中构建并与 Swift 包管理器链接。但是,每当我们将应用程序提交到 AppStore Connect 并使用 TestFlight 分发时,应用程序当它尝试使用 SPM 链接依赖项之一的 API 时崩溃。其他构建(临时和开发)工作正常。一些 SPM 依赖项也链接了 2 个应用程序扩展。
有没有人遇到过这个问题,你知道这是什么问题吗and/or如何解决?
正在附加崩溃的堆栈跟踪。这发生在 ObjectMapper
依赖项中。
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x00000000800000d0
Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [19562]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 OurAwesomeApp 0x0000000101693d14 nominal type descriptor for EnumTransform + 0
1 OurAwesomeApp 0x000000010108cda0 <- infix<A>(_:_:) + 612 (__hidden#1488_:38)
2 OurAwesomeApp 0x0000000101074434 <- infix<A>(_:_:) + 100 (__hidden#434_:36)
3 OurAwesomeApp 0x0000000100cad360 TWSplitParticipant.mapping(map:) + 1388 (DataClasses.swift:1211)
4 OurAwesomeApp 0x00000001010842cc Mapper.map(JSON:) + 1224 (__hidden#1191_:106)
5 OurAwesomeApp 0x0000000101087c70 _hidden#1144_ + 24 (__hidden#110_:0)
6 libswiftCore.dylib 0x000000018f3cd61c $sSTsE10compactMapySayqd__Gqd__Sg7ElementQzKXEKlF + 732 (SequenceAlgorithms.swift:807)
7 OurAwesomeApp 0x0000000101084a68 Mapper.mapArray(JSONArray:) + 212 (__hidden#1191_:166)
8 OurAwesomeApp 0x0000000101082a8c Mapper.mapArray(JSONObject:) + 192 (__hidden#1191_:156)
9 OurAwesomeApp 0x00000001010753d4 _hidden#461_ + 148 (__hidden#487_:92)
10 OurAwesomeApp 0x0000000101088c8c _hidden#1301_ + 196
11 OurAwesomeApp 0x0000000100cac720 TWSplitRequest.mapping(map:) + 812 (DataClasses.swift:1157)
12 OurAwesomeApp 0x00000001010842cc Mapper.map(JSON:) + 1224 (__hidden#1191_:106)
13 OurAwesomeApp 0x0000000101082988 Mapper.map(JSONObject:) + 160 (__hidden#1191_:89)
14 OurAwesomeApp 0x00000001010752f0 _hidden#459_ + 644 (__hidden#487_:66)
15 OurAwesomeApp 0x000000010108896c <- infix<A>(_:_:) + 152 (__hidden#1307_:116)
16 OurAwesomeApp 0x0000000100ca7248 TWInvoice.mapping(map:) + 4000 (DataClasses.swift:377)
17 OurAwesomeApp 0x00000001010842cc Mapper.map(JSON:) + 1224 (__hidden#1191_:106)
18 OurAwesomeApp 0x0000000101087c70 _hidden#1144_ + 24 (__hidden#110_:0)
19 libswiftCore.dylib 0x000000018f3cd61c $sSTsE10compactMapySayqd__Gqd__Sg7ElementQzKXEKlF + 732 (SequenceAlgorithms.swift:807)
20 OurAwesomeApp 0x0000000101084a68 Mapper.mapArray(JSONArray:) + 212 (__hidden#1191_:166)
21 OurAwesomeApp 0x0000000101082a8c Mapper.mapArray(JSONObject:) + 192 (__hidden#1191_:156)
22 OurAwesomeApp 0x00000001010753d4 _hidden#461_ + 148 (__hidden#487_:92)
23 OurAwesomeApp 0x0000000101088c8c _hidden#1301_ + 196
24 OurAwesomeApp 0x0000000100ca5b88 TWInvoicesByType.mapping(map:) + 328 (DataClasses.swift:266)
25 OurAwesomeApp 0x00000001010842cc Mapper.map(JSON:) + 1224 (__hidden#1191_:106)
26 OurAwesomeApp 0x0000000101082988 Mapper.map(JSONObject:) + 160 (__hidden#1191_:89)
27 OurAwesomeApp 0x00000001010752f0 _hidden#459_ + 644 (__hidden#487_:66)
28 OurAwesomeApp 0x000000010108896c <- infix<A>(_:_:) + 152 (__hidden#1307_:116)
29 OurAwesomeApp 0x0000000100ca3adc TWAccount.mapping(map:) + 104 (DataClasses.swift:81)
30 OurAwesomeApp 0x00000001010842cc Mapper.map(JSON:) + 1224 (__hidden#1191_:106)
31 OurAwesomeApp 0x0000000101082988 Mapper.map(JSONObject:) + 160 (__hidden#1191_:89)
32 OurAwesomeApp 0x0000000100c47c18 closure #1 in DataServer.getAccountInfo(_:) + 492 (DataServer.swift:949)
33 OurAwesomeApp 0x00000001011d7888 _hidden#2846_ + 164
34 OurAwesomeApp 0x00000001011db76c _hidden#2893_ + 52 (__hidden#578_:0)
35 OurAwesomeApp 0x00000001011b55e0 _hidden#996_ + 28 (__hidden#578_:0)
36 libdispatch.dylib 0x0000000181e29610 _dispatch_call_block_and_release + 24 (init.c:1408)
37 libdispatch.dylib 0x0000000181e2a184 _dispatch_client_callout + 16 (object.m:495)
38 libdispatch.dylib 0x0000000181e0d35c _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 996 (inline_internal.h:2487)
39 CoreFoundation 0x00000001820da3c4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1749)
40 CoreFoundation 0x00000001820d53b8 __CFRunLoopRun + 2004 (CFRunLoop.c:3069)
41 CoreFoundation 0x00000001820d48bc CFRunLoopRunSpecific + 464 (CFRunLoop.c:3192)
42 GraphicsServices 0x000000018bf40328 GSEventRunModal + 104 (GSEvent.c:2246)
43 UIKitCore 0x000000018616a6d4 UIApplicationMain + 1936 (UIApplication.m:4753)
44 OurAwesomeApp 0x0000000100c1048c main + 68 (OurAwesomeFactoryFactory.swift:25)
45 libdyld.dylib 0x0000000181f5f460 start + 4
2019-11-27更新
在 related Swift bug post 中,有人找到了解决方法:
Setting DEAD_CODE_STRIPPING = NO in our app’s target fixes the crash.
原post
首先,是SPM的编译问题。只需回滚到 CocoaPods。
直到 Xcode 11.2.1,苹果还没有修复这个问题。
删除所有派生文件,清理项目。然后使用 release
配置尝试 运行 您的项目。现在您应该能够重现崩溃了。
我在一个 iOS 项目中使用了两个名为 Moya
和 Parchment
的库,以及从 CocoaPods 迁移而来的 Swift 包管理器。当执行引用这两个库的逻辑时,从 TestFlight 下载的应用程序崩溃。
而且崩溃日志看起来完全是胡说八道,指向一个方法的方法描述符的内存对齐问题。
Apple 在Xcode 发行说明中提到了一个已知问题,不知道是否相关:
If an iOS, tvOS, or watchOS app uses a Swift Package that builds a dynamic library, it cannot be submitted to the App Store. (55564324)
Workaround: Modify the Package manifest to build a static library.