谷歌登录 iOS 11 崩溃

Posted

技术标签:

【中文标题】谷歌登录 iOS 11 崩溃【英文标题】:Google SignIn iOS 11 crash 【发布时间】:2018-05-04 00:15:48 【问题描述】:

我遇到了这个仅在 ios11 上出现的问题。我已经在 iOS 9 和 10 中进行了测试,并且运行良好。

我已经按照文档所述进行了配置: - 我的反向客户端的 URL 类型。 - 项目中的 GoogleService-Info.plist

pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'

pod 'Firebase'
pod 'Firebase/Auth'
pod 'GoogleSignIn'
pod 'GoogleTagManager', '~> 6.0'

pod 'Firebase/Database'
pod 'Firebase/Core'
pod 'Firebase/Messaging'

版本:

Using FBSDKCoreKit (4.27.1)
Using FBSDKLoginKit (4.27.1)
Using Firebase (4.5.0)
Using FirebaseAnalytics (4.0.4)
Using FirebaseAuth (4.3.1)
Using FirebaseCore (4.0.10)
Using FirebaseDatabase (4.1.0)
Using FirebaseInstanceID (2.0.5)
Using FirebaseMessaging (2.0.6)
Using GTMOAuth2 (1.1.5)
Using GTMSessionFetcher (1.1.12)
Using GoogleAnalytics (3.17.0)
Using GoogleSignIn (4.1.1)
Using GoogleSymbolUtilities (1.1.2)
Using GoogleTagManager (6.0.0)
Using GoogleToolboxForMac (2.1.3)
Using GoogleUtilities (1.3.2)

问题出现在 AppDelegate 的 didFinishLaunchingWithOptions 行 GIDSignIn.sharedInstace() 中:

FirebaseApp.configure()
GIDSignIn.sharedInstance().clientID = FirebaseApp.app()?.options.clientID

错误日志:

2017-11-20 15:19:38.299580-0200 App[28192:769548] [Firebase/Analytics] Firebase Analytics v.40004000 started
2017-11-20 15:19:38.301248-0200 App[28192:769548] [Firebase/Analytics] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see ...)
2017-11-20 15:19:38.396773-0200 App[28192:768847] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001158c71cb __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x0000000115231f41 objc_exception_throw + 48
    2   CoreFoundation                      0x0000000115906e8c _CFThrowFormattedException + 194
    3   CoreFoundation                      0x00000001157f72b4 -[__NSArrayM objectAtIndex:] + 148
    4   App                           0x000000010cd90c27 -[GIDSignIn init] + 150
    5   App                           0x000000010cd90b6b __27+[GIDSignIn sharedInstance]_block_invoke + 38
    6   libdispatch.dylib                   0x0000000116ec943c _dispatch_client_callout + 8
    7   libdispatch.dylib                   0x0000000116eca9c7 dispatch_once_f + 297
    8   App                           0x000000010cd90b43 +[GIDSignIn sharedInstance] + 102
    9   App                           0x000000010c8a336d _T09App11AppDelegateC16sdkConfigurationySo13UIApplicationC11application_s10DictionaryVySC0F16LaunchOptionsKeyVypGSg022didFinishLaunchingWithJ0tF + 157
    10  App                           0x000000010c8a08a0 _T09App11AppDelegateC11applicationSbSo13UIApplicationC_s10DictionaryVySC0E16LaunchOptionsKeyVypGSg022didFinishLaunchingWithH0tF + 144
    11  App                           0x000000010c8a11fa _T09App11AppDelegateC11applicationSbSo13UIApplicationC_s10DictionaryVySC0E16LaunchOptionsKeyVypGSg022didFinishLaunchingWithH0tFTo + 186
    12  UIKit                               0x000000011252735a -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 267
    13  UIKit                               0x0000000112528db7 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4105
    14  UIKit                               0x000000011252e245 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720
    15  UIKit                               0x00000001128e9c6c __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924
    16  UIKit                               0x0000000112cb73ef +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
    17  UIKit                               0x00000001128e9865 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249
    18  UIKit                               0x00000001128ea0c3 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 668
    19  UIKit                               0x0000000113247c11 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262
    20  UIKit                               0x0000000113247aca -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444
    21  UIKit                               0x0000000112f35b9c __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 420
    22  UIKit                               0x0000000113130c3e _performActionsWithDelayForTransitionContext + 100
    23  UIKit                               0x0000000112f35998 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231
    24  UIKit                               0x0000000112cb6a4c -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
    25  UIKit                               0x000000011252cac6 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523
    26  UIKit                               0x0000000112af5523 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369
    27  FrontBoardServices                  0x000000011bbc9158 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338
    28  FrontBoardServices                  0x000000011bbd1c4d __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235
    29  libdispatch.dylib                   0x0000000116ec943c _dispatch_client_callout + 8
    30  libdispatch.dylib                   0x0000000116eceaf4 _dispatch_block_invoke_direct + 592
    31  FrontBoardServices                  0x000000011bbfd672 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
    32  FrontBoardServices                  0x000000011bbfd328 -[FBSSerialQueue _performNext] + 464
    33  FrontBoardServices                  0x000000011bbfd897 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    34  CoreFoundation                      0x000000011586a2b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    35  CoreFoundation                      0x0000000115909d31 __CFRunLoopDoSource0 + 81
    36  CoreFoundation                      0x000000011584ec19 __CFRunLoopDoSources0 + 185
    37  CoreFoundation                      0x000000011584e1ff __CFRunLoopRun + 1279
    38  CoreFoundation                      0x000000011584da89 CFRunLoopRunSpecific + 409
    39  GraphicsServices                    0x00000001189ce9c6 GSEventRunModal + 62
    40  UIKit                               0x000000011252fd30 UIApplicationMain + 159
    41  App                           0x000000010c8a6287 main + 55
    42  libdyld.dylib                       0x0000000116f45d81 start + 1
    43  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

有人可以帮助我吗?

【问题讨论】:

该错误与 Google 登录无关,它表示数组索引超出范围。 【参考方案1】:

我解决了这个问题。 事情是 swift 3.2,我只是将项目更新到 swift 4,然后再次卸载并安装应用程序,一切正常......

【讨论】:

以上是关于谷歌登录 iOS 11 崩溃的主要内容,如果未能解决你的问题,请参考以下文章

如何从ios中的谷歌帐户注销?

谷歌登录不适用于 iOS 10

谷歌分析在 ios 崩溃前的最后一个屏幕

谷歌地图 imageMapType 崩溃 iOS Safari

Flutter:如何从谷歌登录firebase获取生日? (安卓和iOS)

电脑谷歌浏览器登不了怎么办