我使用Facebook SDK v3.14。我发现方法[FBAppEvents activateApp]
随机崩溃。因为[FBAppEvents activateApp]
应写在- (void)applicationDidBecomeActive:(UIApplication *)application
我们的applicationDidBecomeActive应该每天调用大约100M,大约10天[FBAppEvents activateApp]
崩溃大约1K次。
崩溃日志在这里,任何人帮助我,thx。
type: signal
subtype: SIGSEGV
shavalue: 1ebce91b2b00be8084bb4cae3b666f4c
content:
• Crashed thread 0x00000000
• 0 Weibo 0x00718df5 -[WBRecordCrashLog p_updateBacktraceToDictionary:fromSigalCode:] + 408
• 1 Weibo 0x00718757 signalHandler + 298
• 2 libsystem_platform.dylib 0x38317f8b _sigtramp + 34
• 3 CoreFoundation 0x2d4e1105 + 76
• 4 UIKit 0x3016d039 + 236
• 5 Weibo 0x00a0d349 +[FBUtility attributionID] + 44
• 6 Weibo 0x00a282e5 +[FBSettings publishInstall:withHandler:isAutoPublish:] + 456
• 7 Weibo 0x00a28119 +[FBSettings publishInstall:withHandler:] + 44
• 8 Weibo 0x00a3949f +[FBAppEvents activateApp] + 34
• 9 Weibo 0x0014b60d -[TweetterAppDelegate applicationDidBecomeActive:] + 40
• 10 UIKit 0x2fe3f6bb + 374
• 11 UIKit 0x2fe2a6e1 + 1088
• 12 UIKit 0x2fdc66e9 + 3540
• 13 UIKit 0x2fdc5851 + 72
• 14 UIKit 0x2fe29ca9 + 616
• 15 GraphicsServices 0x323fbaed + 608
• 16 GraphicsServices 0x323fb6d7 + 34
• 17 CoreFoundation 0x2d56ea67 + 34
• 18 CoreFoundation 0x2d56ea03 + 346
• 19 CoreFoundation 0x2d56d1d7 + 1398
• 20 CoreFoundation 0x2d4d7ebf CFRunLoopRunSpecific + 522
• 21 CoreFoundation 0x2d4d7ca3 CFRunLoopRunInMode + 106
• 22 UIKit 0x2fe28ed1 + 760
• 23 UIKit 0x2fe2414d UIApplicationMain + 1136
• 24 Weibo 0x001723db main + 58
• 25 Weibo 0x00147c04 start + 40
我已经下载了Facebook SDK源代码,[FBUtility attributionID]
就在这里:
+ (NSString *)attributionID {
return [[UIPasteboard pasteboardWithName:@"fb_app_attribution" create:NO] string];
}
我找到了一些文档,没有文档告诉我pasteboardWithName
或[UIPasteboard string]
会导致崩溃
答案 0 :(得分:0)
我已经使用Method Swizzling来防止崩溃使用我的自定义方法交换方法(+[FBUtility attributionID]
)
这样的代码:
Appdelegate.m
中的
Method leftMethod = class_getClassMethod(NSClassFromString(@"FBUtility"), NSSelectorFromString(@"attributionID"));
Method rightMethod = class_getClassMethod(NSClassFromString(@"MyHackFBUtility"), NSSelectorFromString(@"attributionID"));
method_exchangeImplementations(leftMethod, rightMethod);
MyHackFBUtility.m
中的
+ (NSString *)attributionID {
return nil;
}
它运行好几个月