ShareKit导致我的iOS应用程序崩溃?
我刚刚在iTunes Connect上看到了一个崩溃报告,所以我将它加载到Xcode中,这对我来说是一个符号 相关部分为:ShareKit导致我的iOS应用程序崩溃?,ios,crash,sharekit,viewdidload,Ios,Crash,Sharekit,Viewdidload,我刚刚在iTunes Connect上看到了一个崩溃报告,所以我将它加载到Xcode中,这对我来说是一个符号 相关部分为: Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x00000000, 0x00000000 Crashed Thread: 0 Last Exception Backtrace: 0 CoreFoundation 0x323e188f __exceptionPreproc
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x323e188f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x34437259 objc_exception_throw + 33
2 CoreFoundation 0x323e1789 +[NSException raise:format:] + 1
3 CoreFoundation 0x323e17ab +[NSException raise:format:] + 35
4 Bitrate Tester 0x00048435 0x0001a435
5 Bitrate Tester 0x00031473 -[FirstViewController viewDidLoad] (FirstViewController.m:27)
FirstViewController是我的应用程序显示的第一个视图控制器,这并不奇怪,这意味着[FirstViewController viewDidLoad]
基本上是我的应用程序中调用的第一个实际方法。因此,以前没有太多的可能被错误地调用
现在,这就是viewDidLoad
的外观:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
DefaultSHKConfigurator *configurator = [[MySHKConfigurator alloc] init];
[SHKConfiguration sharedInstanceWithConfigurator:configurator];
[SHK setFavorites:[NSArray arrayWithObjects:@"SHKFacebook",@"SHKTwitter",@"SHKMail",nil] forType:SHKShareTypeText];
}
第27行是
[SHKConfiguration sharedInstanceWithConfigurator:configurator];
那么,ShareKit是否导致我的应用程序崩溃??请注意,我无法在我的任何设备上重现这个问题(我在iOS模拟器上进行了测试,在iOS 5.1.1上测试了iPhone4,在iOS 5.1.1上测试了iPad2,在iOS 5.1.1上测试了iPhone3GS)。有什么想法吗?我想在你的应用程序中调用的第一个方法是applicationdFinishLaunchingwithoptions:在你的应用程序委托中,而不是viewDidLoad 有时可能会卸载视图(例如,由于内存不足),然后再次加载。这次configurator可能会加载两次,这很糟糕
因此,解决方案可能是将ShareKit配置移动到ApplicationIDFinishLaunchingWithOptions,如中所述。此方法保证只调用一次。看起来肯定像是sharekit问题。可能是因为某种原因。看起来它已经被报道过了,但由于难以复制而从未被修复。我认为这是有意义的,我会尝试移动它,看看崩溃是否持续。。。同时给你+1。