令牌被撤销后,Google SignIn会崩溃

时间:2016-08-29 17:34:24

标签: ios google-signin

我正在使用Google驱动器来允许服务器访问我的驱动器。我使用SignIn来获取传递给它的服务器的令牌,以便它可以访问驱动器。

我可以登录应用确定,它会为Drive请求相应的权限。

问题是当我取消对我之前已授权使用SignIn崩溃的应用程序的驱动器的访问权限时。

*** -[GSDK_GTMSessionFetcherService fetcherWithRequest:]: message sent to deallocated instance 0x7ff2706c8440

知道造成这种情况的原因。我找不到解决方案。由于pod将代码分发为框架,因此我无法轻松获取代码。

我正在使用GoogleSignIn 4.0.0

这是崩溃期间的堆栈跟踪。

2016-08-30 12:28:10.485 MyAPP [68739:3873962] CRASH: -[__NSCFType fetcherWithRequest:]: unrecognized selector sent to instance 0x7fcb28475580
2016-08-30 12:28:10.486 MyAPP [68739:3873962] Stack Trace: (
    0   CoreFoundation                      0x0000000107fe3d85 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000107615deb objc_exception_throw + 48
    2   CoreFoundation                      0x0000000107fecd3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x0000000107f32cfa ___forwarding___ + 970
    4   CoreFoundation                      0x0000000107f328a8 _CF_forwarding_prep_0 + 120
    5   MyAPP                               0x0000000101e89a9e -[GSDK_GTMOAuth2Authentication beginTokenFetchWithDelegate:didFinishSelector:] + 768
    6   MyAPP                               0x0000000101cc2307 +[GIDTokenFetchDelegate beginTokenFetchWithAuth:handler:] + 126
    7   MyAPP                               0x0000000101cbb15a -[GIDSignIn maybeFetchToken:fallback:] + 615
    8   MyAPP                               0x0000000101cba9dc -[GIDSignIn clearAndAuthenticateWithOptions:] + 343
    9   MyAPP                               0x0000000101cba791 -[GIDSignIn signInWithOptions:] + 548
    10  MyAPP                               0x0000000101cb7163 -[GIDSignIn signIn] + 64
    11  MyAPP                               0x00000001017b2a2a -[SendGoogleAuthOperation signInIfPossible] + 458
    12  MyAPP                               0x00000001017b2849 -[SendGoogleAuthOperation requestSignIn] + 169
    13  MyAPP                               0x00000001017b278d -[SendGoogleAuthOperation start] + 621
    14  Foundation                          0x0000000104034336 __NSOQSchedule_f + 194
    15  libdispatch.dylib                   0x00000001096093eb _dispatch_client_callout + 8
    16  libdispatch.dylib                   0x00000001095ef82c _dispatch_queue_drain + 2215
    17  libdispatch.dylib                   0x00000001095eed4d _dispatch_queue_invoke + 601
    18  libdispatch.dylib                   0x00000001095f1996 _dispatch_root_queue_drain + 1420
    19  libdispatch.dylib                   0x00000001095f1405 _dispatch_worker_thread3 + 111
    20  libsystem_pthread.dylib             0x000000010995d4de _pthread_wqthread + 1129
    21  libsystem_pthread.dylib             0x000000010995b341 start_wqthread + 13
)
2016-08-30 12:28:10.487 MyAPP [68739:3873962] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType fetcherWithRequest:]: unrecognized selector sent to instance 0x7fcb28475580'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000107fe3d85 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000107615deb objc_exception_throw + 48
    2   CoreFoundation                      0x0000000107fecd3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x0000000107f32cfa ___forwarding___ + 970
    4   CoreFoundation                      0x0000000107f328a8 _CF_forwarding_prep_0 + 120
    5   MyAPP                               0x0000000101e89a9e -[GSDK_GTMOAuth2Authentication beginTokenFetchWithDelegate:didFinishSelector:] + 768
    6   MyAPP                               0x0000000101cc2307 +[GIDTokenFetchDelegate beginTokenFetchWithAuth:handler:] + 126
    7   MyAPP                               0x0000000101cbb15a -[GIDSignIn maybeFetchToken:fallback:] + 615
    8   MyAPP                               0x0000000101cba9dc -[GIDSignIn clearAndAuthenticateWithOptions:] + 343
    9   MyAPP                               0x0000000101cba791 -[GIDSignIn signInWithOptions:] + 548
    10  MyAPP                               0x0000000101cb7163 -[GIDSignIn signIn] + 64
    11  MyAPP                               0x00000001017b2a2a -[SendGoogleAuthOperation signInIfPossible] + 458
    12  MyAPP                               0x00000001017b2849 -[SendGoogleAuthOperation requestSignIn] + 169
    13  MyAPP                               0x00000001017b278d -[SendGoogleAuthOperation start] + 621
    14  Foundation                          0x0000000104034336 __NSOQSchedule_f + 194
    15  libdispatch.dylib                   0x00000001096093eb _dispatch_client_callout + 8
    16  libdispatch.dylib                   0x00000001095ef82c _dispatch_queue_drain + 2215
    17  libdispatch.dylib                   0x00000001095eed4d _dispatch_queue_invoke + 601
    18  libdispatch.dylib                   0x00000001095f1996 _dispatch_root_queue_drain + 1420
    19  libdispatch.dylib                   0x00000001095f1405 _dispatch_worker_thread3 + 111
    20  libsystem_pthread.dylib             0x000000010995d4de _pthread_wqthread + 1129
    21  libsystem_pthread.dylib             0x000000010995b341 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

1 个答案:

答案 0 :(得分:1)

好的,如果有人碰到这个,你必须在主线程上登录

dispatch_async(dispatch_get_main_queue(), ^{ 

     [self.signIn signIn];
});

可能会节省一些时间:)