7月25号提交苹果审核之后,26号收到邮件被拒并在iTunes connect中收到详细被拒的原因和Crash日志附件。
崩溃日志信息如下:
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018154c5e8 0x18152e000 + 124392
1 XHQB 0x0000000100707944 0x100084000 + 6830404
2 Foundation 0x0000000182f5cd94 0x182f3c000 + 134548
3 Foundation 0x0000000182f60f50 0x182f3c000 + 151376
4 XHQB 0x000000010025a5f4 0x100084000 + 1926644
5 Foundation 0x00000001830464cc 0x182f3c000 + 1090764
6 CoreFoundation 0x000000018250142c 0x182426000 + 898092
7 CoreFoundation 0x0000000182500d9c 0x182426000 + 896412
8 CoreFoundation 0x00000001824fe9a8 0x182426000 + 887208
9 CoreFoundation 0x000000018242eda4 0x182426000 + 36260
10 GraphicsServices 0x0000000183e98074 0x183e8c000 + 49268
11 UIKit 0x00000001886e2058 0x18866d000 + 479320
12 XHQB 0x000000010022cab4 0x100084000 + 1739444
13 libdyld.dylib 0x000000018143d59c 0x181439000 + 17820
Thread 1 name: Dispatch queue: org.webkit.ImageDecoder
Thread 1:
0 libsystem_kernel.dylib 0x000000018154ce1c 0x18152e000 + 126492
1 libsystem_pthread.dylib 0x0000000181614814 0x181612000 + 10260
2 JavaScriptCore 0x000000018642e8b4 0x186421000 + 55476
3 JavaScriptCore 0x0000000186dc1b18 0x186421000 + 10095384
4 WebCore 0x000000018726ab20 0x1870b6000 + 1788704
5 WebCore 0x00000001876c57d8 0x1870b6000 + 6354904
6 WebCore 0x00000001876c5734 0x1870b6000 + 6354740
7 libdispatch.dylib 0x000000018140a9e0 0x181409000 + 6624
8 libdispatch.dylib 0x000000018140a9a0 0x181409000 + 6560
9 libdispatch.dylib 0x0000000181418ad4 0x181409000 + 64212
10 libdispatch.dylib 0x000000018140e2cc 0x181409000 + 21196
11 libdispatch.dylib 0x000000018141aa50 0x181409000 + 72272
12 libdispatch.dylib 0x000000018141a7d0 0x181409000 + 71632
13 libsystem_pthread.dylib 0x0000000181613100 0x181612000 + 4352
14 libsystem_pthread.dylib 0x0000000181612cac 0x181612000 + 3244
Thread 2:
0 libsystem_pthread.dylib 0x0000000181612ca8 0x181612000 + 3240
Thread 3:
0 libsystem_kernel.dylib 0x000000018154d314 0x18152e000 + 127764
1 libsystem_c.dylib 0x000000018146c8b0 0x181460000 + 51376
2 libc++.1.dylib 0x0000000180f7d3c4 0x180f36000 + 291780
3 JavaScriptCore 0x0000000186dd9d08 0x186421000 + 10194184
4 JavaScriptCore 0x0000000186dd9adc 0x186421000 + 10193628
5 JavaScriptCore 0x0000000186ddaebc 0x186421000 + 10198716
6 JavaScriptCore 0x0000000186ddade8 0x186421000 + 10198504
7 JavaScriptCore 0x0000000186ddb098 0x186421000 + 10199192
8 libsystem_pthread.dylib 0x000000018161568c 0x181612000 + 13964
9 libsystem_pthread.dylib 0x000000018161559c 0x181612000 + 13724
10 libsystem_pthread.dylib 0x0000000181612cb4 0x181612000 + 3252
Thread 4 name: WebThread
Thread 4:
0 libsystem_kernel.dylib 0x000000018154ce1c 0x18152e000 + 126492
1 libsystem_pthread.dylib 0x0000000181614814 0x181612000 + 10260
2 Foundation 0x0000000182f99a9c 0x182f3c000 + 383644
3 Foundation 0x0000000182f5ccc8 0x182f3c000 + 134344
4 Foundation 0x0000000182f60f50 0x182f3c000 + 151376
5 XHQB 0x000000010025aadc 0x100084000 + 1927900
6 libsystem_platform.dylib 0x000000018161130c 0x18160b000 + 25356
7 UIKit 0x00000001886737b8 0x18866d000 + 26552
8 UIKit 0x000000018897b04c 0x18866d000 + 3203148
9 UIKit 0x000000018867a0b4 0x18866d000 + 53428
10 QuartzCore 0x000000018586a274 0x185753000 + 1143412
11 QuartzCore 0x000000018585ede8 0x185753000 + 1097192
12 QuartzCore 0x000000018585eca8 0x185753000 + 1096872
13 QuartzCore 0x00000001857da34c 0x185753000 + 553804
14 QuartzCore 0x00000001858013ac 0x185753000 + 713644
15 QuartzCore 0x0000000185801e78 0x185753000 + 716408
16 CoreFoundation 0x00000001825009a8 0x182426000 + 895400
17 CoreFoundation 0x00000001824fe630 0x182426000 + 886320
18 CoreFoundation 0x000000018242edc4 0x182426000 + 36292
19 WebCore 0x00000001870f9608 0x1870b6000 + 275976
20 libsystem_pthread.dylib 0x000000018161568c 0x181612000 + 13964
21 libsystem_pthread.dylib 0x000000018161559c 0x181612000 + 13724
22 libsystem_pthread.dylib 0x0000000181612cb4 0x181612000 + 3252
Thread 5 name: com.apple.uikit.eventfetch-thread
Thread 5:
0 libsystem_kernel.dylib 0x000000018152f224 0x18152e000 + 4644
1 libsystem_kernel.dylib 0x000000018152f09c 0x18152e000 + 4252
2 CoreFoundation 0x0000000182500e90 0x182426000 + 896656
3 CoreFoundation 0x00000001824feae4 0x182426000 + 887524
4 CoreFoundation 0x000000018242eda4 0x182426000 + 36260
5 Foundation 0x0000000182f48d74 0x182f3c000 + 52596
6 Foundation 0x0000000182f69b44 0x182f3c000 + 187204
7 UIKit 0x000000018906c6a8 0x18866d000 + 10483368
8 Foundation 0x00000001830462d8 0x182f3c000 + 1090264
9 libsystem_pthread.dylib 0x000000018161568c 0x181612000 + 13964
10 libsystem_pthread.dylib 0x000000018161559c 0x181612000 + 13724
11 libsystem_pthread.dylib 0x0000000181612cb4 0x181612000 + 3252
此时并不能看出任何信息,经百度后得到要使用苹果自带的崩溃分析工具解析日志。具体步骤如下:
- 进行崩溃分析,首先要弄懂一个概念,就是符号集。符号集是我们对ipa文件进行打包之后,和.app文件同级的后缀名为.dSYM的文件,这个文件必须使用Xcode进行打包才有。每一个.dSYM文件都有一个UUID,和.app文件中的UUID对应,代表着是一个应用。而.dSYM文件中每一条崩溃信息也有一个单独的UUID,用来和程序的UUID进行校对。我们如果不使用.dSYM文件获取到的崩溃信息都是不准确的。符号集中存储着文件名、方法名、行号的信息,是和可执行文件的16进制函数地址对应的,通过分析崩溃的.Crash文件可以准确知道具体的崩溃信息。我们每次Archive一个包之后,都会随之生成一个dSYM文件。每次发布一个版本,我们都需要备份这个文件,以方便以后的调试。进行崩溃信息符号化的时候,必须使用当前应用打包的电脑所生成的dSYM文件,其他电脑生成的文件可能会导致分析不准确的问题。当程序崩溃的时候,我们可以获得到崩溃的错误堆栈,但是这个错误堆栈都是0x开头的16进制地址,需要我们使用Xcode自带的symbolicatecrash工具来将.Crash和.dSYM文件进行符号化,就可以得到详细崩溃的信息。
- 命令行解析苹果附件中的Crash日志,步骤如下:
1.将symbolicatecrash,Xcode自带的崩溃分析工具,使用这个工具可以更精确的定位崩溃所在的位置,将0x开头的地址替换为响应的代码和具体行数。 我们打包时产生的dSYM文件。崩溃时产生的Crash文件。这三个文件放到一个新建的Crash文件夹中。
- 苹果给的日志是.txt后缀的文件,改成.Crash后缀的文件,命名可以和.dSYM命名相同;
- .dSYM文件通过organizers获取得到;
- Xcode自带的崩溃分析工具,symbolicatecrash通过在终端输入:find /Applications/Xcode.app -name symbolicatecrash -type f,等一会后会出现symbolicatecrash的路径。复制前往文件夹即能找到。
2.cd到新建的Crash文件夹目录,此时文件夹中有三个文件。
在终端输入./symbolicatecrash ./.Crash ./.app.dSYM > symbol.crash此时会报错虽然在Crash文件家中也生成了symbol.crash文件,但是里面内容是空的。
,必须再次输入xcode-select -print-path,export DEVELOPER_DIR=/Applications/XCode.app/Contents/Developer,只有再次上次输入上次的命令在Crash文件夹中得到symbol.crash文件。
3.打开symbol.crash文件即可得到具体的崩溃信息。详细如下:
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018154c5e8 __kill + 8
1 XHQB 0x0000000100707944 -[UmengUncaughtExceptionHandler handleException:] + 472
2 Foundation 0x0000000182f5cd94 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 968
3 Foundation 0x0000000182f60f50 -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 144
4 XHQB 0x000000010025a5f4 -[XHUncaughtExceptionHandler handleException:] (XHCrashCatcher.m:65)
5 Foundation 0x00000001830464cc __NSThreadPerformPerform + 340
6 CoreFoundation 0x000000018250142c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
7 CoreFoundation 0x0000000182500d9c __CFRunLoopDoSources0 + 540
8 CoreFoundation 0x00000001824fe9a8 __CFRunLoopRun + 744
9 CoreFoundation 0x000000018242eda4 CFRunLoopRunSpecific + 424
10 GraphicsServices 0x0000000183e98074 GSEventRunModal + 100
11 UIKit 0x00000001886e2058 UIApplicationMain + 208
12 XHQB 0x000000010022cab4 main (main.m:21)
13 libdyld.dylib 0x000000018143d59c start + 4
Thread 1 name: Dispatch queue: org.webkit.ImageDecoder
Thread 1:
0 libsystem_kernel.dylib 0x000000018154ce1c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x0000000181614814 _pthread_cond_wait + 640
2 JavaScriptCore 0x000000018642e8b4 WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 80
3 JavaScriptCore 0x0000000186dc1b18 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 2256
4 WebCore 0x000000018726ab20 bool WTF::ConditionBase::waitUntil<WTF::Lock>(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 172
5 WebCore 0x00000001876c57d8 WTF::SynchronizedFixedQueue<WebCore::ImageFrameCache::ImageFrameRequest, 8ul>::dequeue(WebCore::ImageFrameCache::ImageFrameRequest&) + 136
6 WebCore 0x00000001876c5734 WTF::Function<void ()>::CallableWrapper<WebCore::ImageFrameCache::startAsyncDecodingQueue()::$_0>::call() + 224
7 libdispatch.dylib 0x000000018140a9e0 _dispatch_call_block_and_release + 24
8 libdispatch.dylib 0x000000018140a9a0 _dispatch_client_callout + 16
9 libdispatch.dylib 0x0000000181418ad4 _dispatch_queue_serial_drain + 928
10 libdispatch.dylib 0x000000018140e2cc _dispatch_queue_invoke + 884
11 libdispatch.dylib 0x000000018141aa50 _dispatch_root_queue_drain + 540
12 libdispatch.dylib 0x000000018141a7d0 _dispatch_worker_thread3 + 124
13 libsystem_pthread.dylib 0x0000000181613100 _pthread_wqthread + 1096
14 libsystem_pthread.dylib 0x0000000181612cac start_wqthread + 4
Thread 2:
0 libsystem_pthread.dylib 0x0000000181612ca8 start_wqthread + 0
Thread 3:
0 libsystem_kernel.dylib 0x000000018154d314 __semwait_signal + 8
1 libsystem_c.dylib 0x000000018146c8b0 nanosleep + 212
2 libc++.1.dylib 0x0000000180f7d3c4 std::__1::this_thread::sleep_for(std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > const&) + 80
3 JavaScriptCore 0x0000000186dd9d08 bmalloc::Heap::scavenge(std::__1::unique_lock<bmalloc::StaticMutex>&, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000l> >) + 272
4 JavaScriptCore 0x0000000186dd9adc bmalloc::Heap::concurrentScavenge() + 120
5 JavaScriptCore 0x0000000186ddaebc bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>::threadRunLoop() + 92
6 JavaScriptCore 0x0000000186ddade8 std::__1::__shared_ptr_emplace<std::__1::mutex, std::__1::allocator<std::__1::mutex> >::~__shared_ptr_emplace() + 0
7 JavaScriptCore 0x0000000186ddb098 void* std::__1::__thread_proxy<std::__1::tuple<void (*)(bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*), bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*> >(void*) + 92
8 libsystem_pthread.dylib 0x000000018161568c _pthread_body + 240
9 libsystem_pthread.dylib 0x000000018161559c _pthread_body + 0
10 libsystem_pthread.dylib 0x0000000181612cb4 thread_start + 4
Thread 4 name: WebThread
Thread 4:
0 libsystem_kernel.dylib 0x000000018154ce1c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x0000000181614814 _pthread_cond_wait + 640
2 Foundation 0x0000000182f99a9c -[NSCondition wait] + 240
3 Foundation 0x0000000182f5ccc8 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 764
4 Foundation 0x0000000182f60f50 -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 144
5 XHQB 0x000000010025aadc XHCrashCatcher_SignalHandler (XHCrashCatcher.m:130)
6 libsystem_platform.dylib 0x000000018161130c _sigtramp + 36
7 UIKit 0x00000001886737b8 -[UIView(Hierarchy) subviews] + 152
8 UIKit 0x000000018897b04c -[UIView(CALayerDelegate) _wantsReapplicationOfAutoLayoutWithLayoutDirtyOnEntry:] + 72
9 UIKit 0x000000018867a0b4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1256
10 QuartzCore 0x000000018586a274 -[CALayer layoutSublayers] + 148
11 QuartzCore 0x000000018585ede8 CA::Layer::layout_if_needed(CA::Transaction*) + 292
12 QuartzCore 0x000000018585eca8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
13 QuartzCore 0x00000001857da34c CA::Context::commit_transaction(CA::Transaction*) + 252
14 QuartzCore 0x00000001858013ac CA::Transaction::commit() + 504
15 QuartzCore 0x0000000185801e78 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 120
16 CoreFoundation 0x00000001825009a8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
17 CoreFoundation 0x00000001824fe630 __CFRunLoopDoObservers + 372
18 CoreFoundation 0x000000018242edc4 CFRunLoopRunSpecific + 456
19 WebCore 0x00000001870f9608 RunWebThread(void*) + 456
20 libsystem_pthread.dylib 0x000000018161568c _pthread_body + 240
21 libsystem_pthread.dylib 0x000000018161559c _pthread_body + 0
22 libsystem_pthread.dylib 0x0000000181612cb4 thread_start + 4
Thread 5 name: com.apple.uikit.eventfetch-thread
Thread 5:
0 libsystem_kernel.dylib 0x000000018152f224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018152f09c mach_msg + 72
2 CoreFoundation 0x0000000182500e90 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x00000001824feae4 __CFRunLoopRun + 1060
4 CoreFoundation 0x000000018242eda4 CFRunLoopRunSpecific + 424
5 Foundation 0x0000000182f48d74 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6 Foundation 0x0000000182f69b44 -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7 UIKit 0x000000018906c6a8 -[UIEventFetcher threadMain] + 136
8 Foundation 0x00000001830462d8 __NSThread__start__ + 996
9 libsystem_pthread.dylib 0x000000018161568c _pthread_body + 240
10 libsystem_pthread.dylib 0x000000018161559c _pthread_body + 0
11 libsystem_pthread.dylib 0x0000000181612cb4 thread_start + 4
4.通过分析崩溃日志可以看到第一行是友盟统计的问题:[UmengUncaughtExceptionHandler handleException:],随后查代码发现友盟统计的key没有写正确,更换key之后提交代码,修改Build号为1.0.0.1打包到testFlight测试后,重新提交以供审核。
5.之后故意在项目中制造数组越界的崩溃出现,代码和崩溃日志如下:
-(NSArray *)arr
{
NSLog(@"%@",_arr);
if (!_arr) {
_arr = [NSArray array];
NSLog(@"%@,%ld",_arr,_arr.count);
}
return _arr;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
NSLog(@"%@",self.arr[2]);
return YES;
}
Filtered syslog:
None found
Last Exception Backtrace:
0 CoreFoundation 0x18ce911b8 __exceptionPreprocess + 124
1 libobjc.A.dylib 0x18b8c855c objc_exception_throw + 56
2 CoreFoundation 0x18cdfbbac -[__NSArray0 objectAtIndex:] + 104
3 XHQB 0x1000c7460 -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:107)
4 UIKit 0x192db86a4 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 400
5 UIKit 0x192fc8a98 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3524
6 UIKit 0x192fce808 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1656
7 UIKit 0x192fe3104 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke.3139 + 48
8 UIKit 0x192fcb7ec -[UIApplication workspaceDidEndTransaction:] + 168
9 FrontBoardServices 0x18ea6792c __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
10 FrontBoardServices 0x18ea67798 -[FBSSerialQueue _performNext] + 176
11 FrontBoardServices 0x18ea67b40 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
12 CoreFoundation 0x18ce3eb5c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
13 CoreFoundation 0x18ce3e4a4 __CFRunLoopDoSources0 + 524
14 CoreFoundation 0x18ce3c0a4 __CFRunLoopRun + 804
15 CoreFoundation 0x18cd6a2b8 CFRunLoopRunSpecific + 444
16 UIKit 0x192db17b0 -[UIApplication _run] + 608
17 UIKit 0x192dac534 UIApplicationMain + 208
18 XHQB 0x100230a64 main (main.m:21)
19 libdyld.dylib 0x18bd4d5b8 start + 4
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018be5f014 __pthread_kill + 8
1 libsystem_pthread.dylib 0x000000018bf27450 pthread_kill + 112
2 libsystem_c.dylib 0x000000018bdd3400 abort + 140
3 libc++abi.dylib 0x000000018b89d2d4 __cxa_bad_cast + 0
4 libc++abi.dylib 0x000000018b8bacc0 default_unexpected_handler() + 0
5 libobjc.A.dylib 0x000000018b8c8844 _objc_terminate() + 124
6 libc++abi.dylib 0x000000018b8b766c std::__terminate(void (*)()) + 16
7 libc++abi.dylib 0x000000018b8b7234 __cxa_rethrow + 144
8 libobjc.A.dylib 0x000000018b8c871c objc_exception_rethrow + 44
9 CoreFoundation 0x000000018cd6a32c CFRunLoopRunSpecific + 560
10 UIKit 0x0000000192db17b0 -[UIApplication _run] + 608
11 UIKit 0x0000000192dac534 UIApplicationMain + 208
12 XHQB 0x0000000100230a64 main (main.m:21)
13 libdyld.dylib 0x000000018bd4d5b8 start + 4