我在AppDelegate中使用以下代码获取了当前应用程序的大量崩溃报告:
- (void)prepareFrameworks
{
if([MFMessageComposeViewController canSendText])
(void)[[MFMessageComposeViewController alloc] init];
if([MFMailComposeViewController canSendMail])
(void)[[MFMailComposeViewController alloc] init];
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
(void)[[SLComposeViewController alloc] init];
}
我正在运行代码以减少激活时ComposeViewController的加载时间。
其中一个堆栈跟踪:
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0xe15f851f
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x3ab570ec objc_retain + 11
1 libsystem_blocks.dylib 0x3b07fd97 _Block_object_assign + 386
2 libsystem_blocks.dylib 0x3b07f9e9 _Block_copy_internal + 444
3 UIKit 0x3346f987 +[_UIAsyncInvocation invocationWithBlock:] + 74
4 UIKit 0x33457b87 +[_UIRemoteViewControllerConnectionRequest requestViewController:fromServiceWithBundleIdentifier:serializedAppearanceCustomizations:legacyAppearance:useXPCObjects:exportedHostingObject:serviceViewControllerDeputyInterface:connectionHandler:] + 914
5 UIKit 0x3345a129 +[_UIRemoteViewController requestViewController:fromServiceWithBundleIdentifier:connectionHandler:] + 468
6 MessageUI 0x31f0d37f +[MFMailComposeRemoteViewController requestViewControllerWithConnectionHandler:] + 62
7 MessageUI 0x31f0a79f -[MFMailComposeInternalViewController initWithNibName:bundle:] + 126
8 MessageUI 0x31ef2281 -[MFMailComposeViewController initWithURL:] + 216
9 MY APP 0x000cb881 -[AppDelegate prepareFrameworks] (AppDelegate.m:262)
10 MY APP 0x000cad61 -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:128)
11 UIKit 0x32fae2ff -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 274
12 UIKit 0x32fadd4f -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1390
13 UIKit 0x32fa8353 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 714
14 UIKit 0x32f4341f -[UIApplication handleEvent:withNewEvent:] + 3130
15 UIKit 0x32f42721 -[UIApplication sendEvent:] + 72
16 UIKit 0x32fa7b3d _UIApplicationHandleEvent + 664
17 GraphicsServices 0x353de70d _PurpleEventCallback + 608
18 GraphicsServices 0x353de2f7 PurpleEventCallback + 34
19 CoreFoundation 0x307959df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
20 CoreFoundation 0x3079597b __CFRunLoopDoSource1 + 346
21 CoreFoundation 0x3079414f __CFRunLoopRun + 1398
22 CoreFoundation 0x306fec27 CFRunLoopRunSpecific + 522
23 CoreFoundation 0x306fea0b CFRunLoopRunInMode + 106
24 UIKit 0x32fa6dd9 -[UIApplication _run] + 760
25 UIKit 0x32fa2049 UIApplicationMain + 1136
26 MY APP 0x000cac27 main (main.m:16)