GPPSignIn sharedInstance - > EXC_BAD_ACCESS(代码= EXC_I386_GPFLT)

时间:2014-03-29 13:38:51

标签: ios google-plus nszombie

似乎很长一段时间一切都很好,昨天没有任何可见的原因我开始出错

EXC_BAD_ACCESS (code = EXC_I386_GPFLT) 

在模拟器的下一行(在真实设备上一切正常):

GPPSignIn *signIn = [GPPSignIn sharedInstance];

启用NSZombie消息后更改为

exc_breakpoint (code=exc_i386_bpt subcode=0x0)

这很奇怪,因为即使这行只是viewDidLoad中的一行而且它是应用程序中的第一个视图控制器,我一次又一次地得到错误(〜每3-4个应用程序启动)。我没有对应用配置进行任何更改。

我将不胜感激任何帮助。谢谢!

UPD:libobjc.A.dylib

中发生错误

我可以看到。

UPD:enter image description here

UPD:

2014-03-31 13:54:13.611 SomeApp[450:3c07] *** -[CFString retain]: message sent to deallocated instance 0x10c2ef050
(lldb) bt
* thread #6: tid = 0x2a3b, 0x0000000103978cc4 CoreFoundation`___forwarding___ + 772, queue = 'NSOperationQueue 0x10ea2b870', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
  * frame #0: 0x0000000103978cc4 CoreFoundation`___forwarding___ + 772
    frame #1: 0x0000000103978938 CoreFoundation`__forwarding_prep_0___ + 120
    frame #2: 0x00000001039fb3c7 CoreFoundation`+[__NSArrayI __new:::] + 87
    frame #3: 0x000000010395d386 CoreFoundation`+[NSArray arrayWithObjects:] + 566
    frame #4: 0x00000001002dea06 SomeApp `+[GPPSignIn versionFromServerData:currentVersion:] + 832
    frame #5: 0x00000001002dec24 SomeApp `__28-[GPPSignIn checkSDKVersion]_block_invoke + 197
    frame #6: 0x0000000100277e64 SomeApp `-[GTMHTTPFetcher connectionDidFinishLoading:] + 714
    frame #7: 0x000000010152036b Foundation`__65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 48
    frame #8: 0x000000010145763b Foundation`-[NSBlockOperation main] + 75
    frame #9: 0x00000001014a5d34 Foundation`-[__NSOperationInternal _start:] + 623
    frame #10: 0x00000001014a7c0b Foundation`__NSOQSchedule_f + 64
    frame #11: 0x000000010414372d libdispatch.dylib`_dispatch_client_callout + 8
    frame #12: 0x0000000104131eab libdispatch.dylib`_dispatch_async_redirect_invoke + 174
    frame #13: 0x000000010414372d libdispatch.dylib`_dispatch_client_callout + 8
    frame #14: 0x0000000104133b27 libdispatch.dylib`_dispatch_root_queue_drain + 380
    frame #15: 0x0000000104133d12 libdispatch.dylib`_dispatch_worker_thread2 + 40
    frame #16: 0x0000000104490ef8 libsystem_pthread.dylib`_pthread_wqthread + 314
(lldb) 

1 个答案:

答案 0 :(得分:2)

追踪这是一个奇怪的问题。我只是在模拟器中遇到了[CFString retain]:崩溃的同样问题(在设备上运行正常),但是当我试图在仪器中运行Zombies时,它永远不会显示僵尸。

CFString retain issue on iOS simulator

经过大量搜索后,您的问题引导我使用backtrace命令查明Google+ SDK导致此问题。

虽然这只是一个解决方法,直到谷歌解决了这个问题,你可以让你的应用程序在模拟器上运行,将GPPSignIn包装在预编译器指令中,检查你是否在模拟器中运行:

#if !(TARGET_IPHONE_SIMULATOR)
- (GPPSignIn *) googlePlusSession {
    NSLog(@"Not running on simulator");
    if(_googlePlusSession == nil) {
        _googlePlusSession = [GPPSignIn sharedInstance];
        _googlePlusSession.clientID = kGoogleClientId;
        _googlePlusSession.scopes = [NSArray arrayWithObjects:kGTLAuthScopePlusLogin,nil];
        _googlePlusSession.delegate = self;
        [_googlePlusSession trySilentAuthentication];
    }
    return _googlePlusSession;
}
#endif

显然,在模拟器上运行时,这会破坏应用中的Google+功能,但在我的情况下,这比根本无法启动要好得多。希望这会有所帮助。