问题
Recently my app started breaking if I create the .ipa file for AppStore release. It works fine if I run the same code in emulator or if I run it on my iPhone from xcode, but once I create the release package it crashes while opening a particular view controller.
I went through few of the posts on Stackoverflow where people had similar problems and tried following things:
- Setting
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
for release mode - Setting
GCC_OPTIMIZATION_LEVEL = 0;
for release mode - Commenting out some of the UI components which were added recently
Following is the log I got from the device:
Incident Identifier: 4F30BFF1-71DC-4542-A330-F3786B3302A8
CrashReporter Key: f6fcec71c8263640bd75a0d18937c323d8a95b43
Hardware Model: iPhone8,1
Process: Dummy [633]
Path: /private/var/containers/Bundle/Application/370692A3-C880-4008-8C70-641801FB894A/Dummy.app/Dummy
Identifier: com.example.Dummy
Version: 1.0.71 (1.0.71)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.example.Dummy [741]
Date/Time: 2017-10-09 18:08:28.2604 -0700
Launch Time: 2017-10-09 18:07:45.3034 -0700
OS Version: iPhone OS 10.3.2 (14F89)
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000100518448
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [0]
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libswiftCore.dylib 0x0000000100518448 0x1003c0000 + 1410120
1 libswiftCore.dylib 0x0000000100518448 0x1003c0000 + 1410120
2 Dummy 0x00000001000e2e14 0x10003c000 + 683540
3 Dummy 0x00000001000e351c 0x10003c000 + 685340
4 UIKit 0x000000018b5d3ec0 -[UIViewController loadViewIfRequired] + 1036
5 UIKit 0x000000018b68bff0 -[UINavigationController _layoutViewController:] + 72
6 UIKit 0x000000018b68bec8 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 416
7 UIKit 0x000000018b68b1f8 -[UINavigationController _startTransition:fromViewController:toViewController:] + 144
8 UIKit 0x000000018b68ac2c -[UINavigationController _startDeferredTransitionIfNeeded:] + 856
9 UIKit 0x000000018b68a7e0 -[UINavigationController __viewWillLayoutSubviews] + 64
10 UIKit 0x000000018b68a744 -[UILayoutContainerView layoutSubviews] + 188
11 UIKit 0x000000018b5d107c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1200
12 QuartzCore 0x00000001887c1274 -[CALayer layoutSublayers] + 148
13 QuartzCore 0x00000001887b5de8 CA::Layer::layout_if_needed(CA::Transaction*) + 292
14 QuartzCore 0x00000001887b5ca8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
15 QuartzCore 0x000000018873134c CA::Context::commit_transaction(CA::Transaction*) + 252
16 QuartzCore 0x00000001887583ac CA::Transaction::commit() + 504
17 QuartzCore 0x0000000188758e78 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 120
18 CoreFoundation 0x00000001854509a8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
19 CoreFoundation 0x000000018544e630 __CFRunLoopDoObservers + 372
20 CoreFoundation 0x000000018544ea7c __CFRunLoopRun + 956
21 CoreFoundation 0x000000018537eda4 CFRunLoopRunSpecific + 424
22 GraphicsServices 0x0000000186de8074 GSEventRunModal + 100
23 UIKit 0x000000018b639058 UIApplicationMain + 208
24 Dummy 0x0000000100105f34 0x10003c000 + 827188
25 libdyld.dylib 0x000000018438d59c start + 4
Thread 1:
0 libsystem_pthread.dylib 0x0000000184562ca8 start_wqthread + 0
Thread 2 name: com.apple.uikit.eventfetch-thread
Thread 2:
0 libsystem_kernel.dylib 0x000000018447f224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018447f09c mach_msg + 72
2 CoreFoundation 0x0000000185450e90 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x000000018544eae4 __CFRunLoopRun + 1060
4 CoreFoundation 0x000000018537eda4 CFRunLoopRunSpecific + 424
5 Foundation 0x0000000185e98d74 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6 Foundation 0x0000000185eb9b44 -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7 UIKit 0x000000018bfc36a8 -[UIEventFetcher threadMain] + 136
8 Foundation 0x0000000185f962d8 __NSThread__start__ + 996
9 libsystem_pthread.dylib 0x000000018456568c _pthread_body + 240
10 libsystem_pthread.dylib 0x000000018456559c _pthread_body + 0
11 libsystem_pthread.dylib 0x0000000184562cb4 thread_start + 4
Thread 3:
0 libsystem_kernel.dylib 0x000000018447f224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018447f09c mach_msg + 72
2 Dummy 0x000000010012fcf4 0x10003c000 + 998644
3 libsystem_pthread.dylib 0x000000018456568c _pthread_body + 240
4 libsystem_pthread.dylib 0x000000018456559c _pthread_body + 0
5 libsystem_pthread.dylib 0x0000000184562cb4 thread_start + 4
Thread 4 name: com.apple.NSURLConnectionLoader
Thread 4:
0 libsystem_kernel.dylib 0x000000018447f224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018447f09c mach_msg + 72
2 CoreFoundation 0x0000000185450e90 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x000000018544eae4 __CFRunLoopRun + 1060
4 CoreFoundation 0x000000018537eda4 CFRunLoopRunSpecific + 424
5 CFNetwork 0x0000000185b8adf4 +[NSURLConnection(Loader) _resourceLoadLoop:] + 404
6 Foundation 0x0000000185f962d8 __NSThread__start__ + 996
7 libsystem_pthread.dylib 0x000000018456568c _pthread_body + 240
8 libsystem_pthread.dylib 0x000000018456559c _pthread_body + 0
9 libsystem_pthread.dylib 0x0000000184562cb4 thread_start + 4
Thread 5 name: AVAudioSession Notify Thread
Thread 5:
0 libsystem_kernel.dylib 0x000000018447f224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018447f09c mach_msg + 72
2 CoreFoundation 0x0000000185450e90 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x000000018544eae4 __CFRunLoopRun + 1060
4 CoreFoundation 0x000000018537eda4 CFRunLoopRunSpecific + 424
5 AVFAudio 0x000000019f6c2540 GenericRunLoopThread::Entry(void*) + 164
6 AVFAudio 0x000000019f6e8814 CAPThread::Entry(CAPThread*) + 84
7 libsystem_pthread.dylib 0x000000018456568c _pthread_body + 240
8 libsystem_pthread.dylib 0x000000018456559c _pthread_body + 0
9 libsystem_pthread.dylib 0x0000000184562cb4 thread_start + 4
Thread 6:
0 libsystem_kernel.dylib 0x000000018449da88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x00000001845631a4 _pthread_wqthread + 1260
2 libsystem_pthread.dylib 0x0000000184562cac start_wqthread + 4
Thread 7:
0 libsystem_pthread.dylib 0x0000000184562ca8 start_wqthread + 0
Thread 8:
0 libsystem_kernel.dylib 0x000000018449da88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x00000001845631a4 _pthread_wqthread + 1260
2 libsystem_pthread.dylib 0x0000000184562cac start_wqthread + 4
Thread 9:
0 libsystem_pthread.dylib 0x0000000184562ca8 start_wqthread + 0
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000100d20b80 x1: 0x00000001742ea580 x2: 0x0000000000000008 x3: 0x00000001844e32c0
x4: 0x00000000ffb80038 x5: 0x0000000000000010 x6: 0x0048000004210103 x7: 0x0000000000000000
x8: 0x00000001742e9980 x9: 0x00000001742e9980 x10: 0x0000000000000001 x11: 0xbaddc0dedeadbead
x12: 0x0000010000000100 x13: 0x206e6120676e6970 x14: 0x6c616e6f6974704f x15: 0x000a65756c617620
x16: 0x00000001844d3a1c x17: 0x0000000000000000 x18: 0x0000000000000000 x19: 0x0000000000000000
x20: 0x0000000000000002 x21: 0x0000000000000039 x22: 0x000000010022ac40 x23: 0x0000000000000002
x24: 0x000000000000000b x25: 0x0000000100231dc8 x26: 0x0000000171a68480 x27: 0x00000001aa543000
x28: 0x0000000000000001 fp: 0x000000016fdc0ee0 lr: 0x0000000100518448
sp: 0x000000016fdc0ea0 pc: 0x0000000100518448 cpsr: 0x20000000
I am using Xcode Version 8.3.3 (8E3004b), Swift3. Please let me know if someone had similar issue before, or any guesses to fix this problem!
Thanks!
回答1:
Try to symbolicate crash exactly where it is crashing from frames 2 and 3.
You can symbolicate crash like below:
Based on this link
In your case you have to call as below :
atos -arch arm64 -o <PATH TO Dummy.app.dSYM>/Contents/Resources/DWARF/Dummy -l 0x10003c000 0x00000001000e2e14
Dummy.app.dSYM
is located in
- right click on
Dummy.xcarchive
and thenShow Package Contents
. - In that
dSYMs
folder is there Dummy.app.dSYM
is located in thedSYMs
folder- Copy
Dummy.app.dSYM
to somewhere to your local system. <PATH TO Dummy.app.dSYM>
will be the path of theDummy.app.dSYM
in your local system
来源:https://stackoverflow.com/questions/46673950/ios-app-crashing-in-release-mode-works-in-debug-mode