应用程序从 ipa 文件崩溃但从 Xcode 运行正常?

App Crashes From ipa file but runs fine from Xcode?

当我 运行 我的项目直接从 Xcode 到我的设备时,它 运行 非常完美,没有任何崩溃。但是当我创建该项目的 ipa 文件并使用 iTunes 将该 ipa 安装到我的设备中时,当我单击登录按钮时它崩溃了,后来尝试了很多次登录之后它工作正常。

如果通过互联网提及此问题对我没有帮助。这是我参考的链接

App works fine with developer build with xcode. But crashes when run using ipa file

Gameplay Crashes From ipa file but runs fine from Xcode?

我不明白实现ipa文件的实际问题是什么。 为什么当我直接从 Xcode 运行 时它不会崩溃。当 运行ning 作为 ipa 或来自 Xcode.

时,是否有任何代码压缩或不同的代码编译机制

如有任何帮助,我们将不胜感激。

崩溃日志

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libswiftCore.dylib      0x00000001010b25dc 0x100f74000 + 1304028
1   AppName                 0x00000001001030c4 0x1000bc000 + 291012
2   Appname                 0x00000001001062cc 0x1000bc000 + 303820
3   Alamofire               0x00000001004c9c9c 0x10047c000 + 318620
4   Alamofire               0x00000001004c899c 0x10047c000 + 313756
5   Alamofire               0x0000000100486d08 0x10047c000 + 44296
6   libdispatch.dylib       0x000000018571e1fc 0x18571d000 + 4604
7   libdispatch.dylib       0x000000018571e1bc 0x18571d000 + 4540
8   libdispatch.dylib       0x0000000185722d68 0x18571d000 + 23912
9   CoreFoundation          0x0000000186842810 0x186765000 + 907280
10  CoreFoundation          0x00000001868403fc 0x186765000 + 898044
11  CoreFoundation          0x000000018676e2b8 0x186765000 + 37560
12  GraphicsServices        0x0000000188222198 0x188216000 + 49560
13  UIKit                   0x000000018c7b57fc 0x18c73b000 + 501756
14  UIKit                   0x000000018c7b0534 0x18c73b000 + 480564
15  AppName                 0x0000000100139e4c 0x1000bc000 + 515660
16  libdyld.dylib           0x00000001857515b8 0x18574d000 + 17848

Thread 1:
 0   libsystem_kernel.dylib 0x0000000185863a88 0x185844000 + 129672
 1   libsystem_pthread.dylib    0x0000000185927344 0x185926000 + 4932
 2   libsystem_pthread.dylib    0x0000000185926d8c 0x185926000 + 3468

Thread 2:
 0   libsystem_kernel.dylib 0x0000000185863a88 0x185844000 + 129672
 1   libsystem_pthread.dylib    0x0000000185927160 0x185926000 + 4448
 2   libsystem_pthread.dylib    0x0000000185926d8c 0x185926000 + 3468

 Thread 3:
 0   libsystem_kernel.dylib   0x0000000185863a88 0x185844000 + 129672
 1   libsystem_pthread.dylib    0x0000000185927344 0x185926000 + 4932
 2   libsystem_pthread.dylib    0x0000000185926d8c 0x185926000 + 3468

Thread 4:
0   libsystem_kernel.dylib    0x0000000185863a88 0x185844000 + 129672
1   libsystem_pthread.dylib     0x0000000185927344 0x185926000 + 4932
2   libsystem_pthread.dylib     0x0000000185926d8c 0x185926000 + 3468

Thread 5 name:  com.apple.uikit.eventfetch-thread
Thread 5:
0   libsystem_kernel.dylib      0x0000000185845188 0x185844000 + 4488
1   libsystem_kernel.dylib      0x0000000185844ff8 0x185844000 + 4088
2   CoreFoundation            0x00000001868425d0 0x186765000 + 906704
3   CoreFoundation            0x00000001868401ec 0x186765000 + 897516
4   CoreFoundation            0x000000018676e2b8 0x186765000 + 37560
5   Foundation                0x00000001872ab26c 0x18729f000 + 49772
6   Foundation                0x00000001872cbdd0 0x18729f000 + 183760
7   UIKit                   0x000000018d129c38 0x18c73b000 + 10415160
8  Foundation                0x00000001873a8e68 0x18729f000 + 1089128
9  libsystem_pthread.dylib    0x0000000185929850 0x185926000 + 14416
10  libsystem_pthread.dylib    0x0000000185929760 0x185926000 + 14176
11  libsystem_pthread.dylib    0x0000000185926d94 0x185926000 + 3476

Thread 6:
0   libsystem_kernel.dylib   0x0000000185862e1c 0x185844000 + 126492
1   libsystem_pthread.dylib  0x00000001859289c0 0x185926000 + 10688
2   libc++.1.dylib           0x00000001852513ec 0x18524a000 + 29676
3   JavaScriptCore           0x000000018b0725d0 0x18a799000 + 9278928
4   JavaScriptCore           0x000000018b072544 0x18a799000 + 9278788
5   JavaScriptCore           0x000000018b072424 0x18a799000 + 9278500
6   JavaScriptCore           0x000000018b0726d4 0x18a799000 + 9279188
7   libsystem_pthread.dylib  0x0000000185929850 0x185926000 + 14416
8   libsystem_pthread.dylib  0x0000000185929760 0x185926000 + 14176
9   libsystem_pthread.dylib  0x0000000185926d94 0x185926000 + 3476

Thread 7 name:  com.apple.NSURLConnectionLoader
Thread 7:
0   libsystem_kernel.dylib    0x0000000185845188 0x185844000 + 4488
1   libsystem_kernel.dylib    0x0000000185844ff8 0x185844000 + 4088
2   CoreFoundation            0x00000001868425d0 0x186765000 + 906704
3   CoreFoundation            0x00000001868401ec 0x186765000 + 897516
4   CoreFoundation            0x000000018676e2b8 0x186765000 + 37560
5   CFNetwork                 0x0000000186f73a70 0x186e94000 + 916080
6   Foundation               0x00000001873a8e68 0x18729f000 + 1089128
7   libsystem_pthread.dylib   0x0000000185929850 0x185926000 + 14416
8   libsystem_pthread.dylib    0x0000000185929760 0x185926000 + 14176
9   libsystem_pthread.dylib    0x0000000185926d94 0x185926000 + 3476

Thread 8 name:  JIT Worklist Worker Thread
Thread 8:
0   libsystem_kernel.dylib  0x0000000185862e1c 0x185844000 + 126492
1   libsystem_pthread.dylib 0x00000001859289c0 0x185926000 + 10688
2   libc++.1.dylib          0x00000001852513ec 0x18524a000 + 29676
3   JavaScriptCore          0x000000018b05ad64 0x18a799000 + 9182564
4   JavaScriptCore          0x000000018ae32a5c 0x18a799000 + 6920796
5   JavaScriptCore          0x000000018ae32eac 0x18a799000 + 6921900
6   JavaScriptCore          0x000000018a7a300c 0x18a799000 + 40972
7   JavaScriptCore          0x000000018a7a2f1c 0x18a799000 + 40732
8   libsystem_pthread.dylib 0x0000000185929850 0x185926000 + 14416
9   libsystem_pthread.dylib 0x0000000185929760 0x185926000 + 14176
10  libsystem_pthread.dylib 0x0000000185926d94 0x185926000 + 3476

 Thread 9 name:  WTF Parallel Helper Thread
 Thread 9:
0   libsystem_kernel.dylib    0x0000000185862e1c 0x185844000 + 126492
1   libsystem_pthread.dylib   0x00000001859289c0 0x185926000 + 10688
2   libc++.1.dylib            0x00000001852513ec 0x18524a000 + 29676
3   JavaScriptCore           0x000000018b05ad64 0x18a799000 + 9182564
4   JavaScriptCore           0x000000018b05a2e8 0x18a799000 + 9179880
5   JavaScriptCore          0x000000018b05a088 0x18a799000 + 9179272
6   JavaScriptCore          0x000000018a7a300c 0x18a799000 + 40972
7   JavaScriptCore          0x000000018a7a2f1c 0x18a799000 + 40732
8   libsystem_pthread.dylib  0x0000000185929850 0x185926000 + 14416
9   libsystem_pthread.dylib  0x0000000185929760 0x185926000 + 14176
10  libsystem_pthread.dylib  0x0000000185926d94 0x185926000 + 3476

 Thread 10 name:  com.apple.CoreMotion.MotionThread
 Thread 10:
 0   libsystem_kernel.dylib    0x0000000185845188 0x185844000 + 4488
 1   libsystem_kernel.dylib    0x0000000185844ff8 0x185844000 + 4088
 2   CoreFoundation           0x00000001868425d0 0x186765000 + 906704
 3   CoreFoundation           0x00000001868401ec 0x186765000 + 897516
 4   CoreFoundation           0x000000018676e2b8 0x186765000 + 37560
 5   CoreFoundation           0x00000001867bbb44 0x186765000 + 355140
 6   CoreMotion               0x000000018d631120 0x18d5c3000 + 450848
 7   libsystem_pthread.dylib  0x0000000185929850 0x185926000 + 14416
 8   libsystem_pthread.dyli   0x0000000185929760 0x185926000 + 14176
 9   libsystem_pthread.dylib  0x0000000185926d94 0x185926000 + 3476

Thread 0 crashed with ARM Thread State (64-bit):
 x0: 0x0000000101524380   x1: 0x00000001702f4d00  
    x2:0x0000000000000008   x3: 0x00000001858a922c
x4: 0x0000000000000014   x5: 0x0000000000000010   x6: 
    0x0000000000000000   x7: 0x0000000000000600
x8: 0x00000001702f4900   x9: 0x00000001702f4900  x10:    
    0x0000000000000001  x11: 0xbaddc0dedeadbead
x12: 0x0000010000000100  x13: 0x206e6120676e6970  x14: 
    0x6c616e6f6974704f  x15: 0x000a65756c617620
x16: 0x00000001858996b0  x17: 0x0000000000000000  x18: 
    0x0000000000000000  x19: 0x0000000170442eb0
x20: 0x0000000170e67400  x21: 0x0000000000000000  x22: 
    0x0000000000000000  x23: 0x0000000000000014
x24: 0x00000001ac178d20  x25: 0x0000000000000000  x26: 
    0xffffffffffffffff  x27: 0x0000000170e67400
x28: 0x0000000002ffffff   fp: 0x000000016fd415b0   lr: 
    0x00000001010b25dc
sp: 0x000000016fd415a0   pc: 0x00000001010b25dc cpsr: 0x20000000

谢谢

我假设当您从 Xcode 运行 和 Release 配置部署时,您基本上使用 Debug 配置构建您的应用程序伊帕。我们在发布配置中遇到了类似的无法解释的错误问题,并发现 Swift 优化导致了这个问题。现在我们将发布版本从 Fast, Whole Module Optimization 切换到 Fast, Single-File Optimization,直到我们可以缩小问题范围。

希望对您有所帮助!

您应该查看崩溃日志。

  1. 将您的设备连接到您 Mac
  2. 在Xcode中,按cmd+shift+2。
  3. 找到您的设备,然后按登录按钮
  4. 等一下。然后你可以看到所有的崩溃日志。
  5. 找到与您的应用同名的应用。如果你不明白,post在这里。

我也遇到过同样的问题

您必须编辑方案

存档 --> 构建配置 --> 将其设置为调试 现在尝试存档并测试您的 IPA。它应该可以正常工作。