Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GPPSignIn sharedInstance -> EXC_BAD_ACCESS (code = EXC_I386_GPFLT)

It seems that everything was fine for a long time and yesterday without any visible reasons I started to get error

EXC_BAD_ACCESS (code = EXC_I386_GPFLT) 

on the next line on emulator (everything is ok on real device):

GPPSignIn *signIn = [GPPSignIn sharedInstance];

After enabling NSZombie message changed to

exc_breakpoint (code=exc_i386_bpt subcode=0x0).

It is very strange because even if this line is only one in the viewDidLoad and it is the first view controller in the app I get error time after time (~every 3-4 app launch). I didn't make any changes to app configuration.

I will be grateful for any help. Thank you!

UPD: error occurs in libobjc.A.dylib

as I can see.

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) 
like image 904
Dmitry Sikorsky Avatar asked Mar 29 '14 13:03

Dmitry Sikorsky


1 Answers

This is a strange issue to track down. I've been having the same problem with the [CFString retain]: crash only in the simulator (runs fine on device), but when I tried to run Zombies in Instruments it would never show a zombie.

CFString retain issue on iOS simulator

After tons of searching, your question lead me to use the backtrace command to find out that the Google+ SDK was causing the issue.

While this is only a workaround until Google fixes the issue, you can get your app to run on the simulator by wrapping your GPPSignIn in precompiler directives that check if you are running in the simulator:

#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

Obviously this screws up the Google+ functionality in your app when running on the simulator, but in my case that was much better than not being able to launch at all. Hope this helps.

like image 101
jday Avatar answered Nov 18 '22 03:11

jday