我正在使用适用于iOS的Firebase用户界面使用google或facebook登录我的应用。我刚刚将pod更新为此版本:
Installing FBSDKCoreKit 4.31.1 (was 4.31.0)
Installing FBSDKLoginKit 4.31.1 (was 4.31.0)
Installing Fabric 1.7.6 (was 1.7.5)
Installing Firebase 4.12.0 (was 4.9.0)
Installing FirebaseAnalytics 4.1.0 (was 4.0.9)
Installing FirebaseAuth 4.6.0 (was 4.4.3)
Installing FirebaseCore 4.0.19 (was 4.0.15)
Installing FirebaseInstanceID 2.0.10 (was 2.0.9)
Installing FirebaseMessaging 2.2.0 (was 2.1.0)
Installing FirebaseUI 4.5.5 (was 4.5.1)
Installing GTMSessionFetcher 1.1.15 (was 1.1.14)
但是现在我在调用getIDTokenForcingRefresh
时遇到错误。这是错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil'
GTMSessionFetcher
- (void)invokeFetchCallbacksOnCallbackQueueWithData:(GTM_NULLABLE NSData *)data
error:(GTM_NULLABLE NSError *)error {
// Callbacks will be released in the method stopFetchReleasingCallbacks:
GTMSessionFetcherCompletionHandler handler;
@synchronized(self) {
GTMSessionMonitorSynchronized(self);
handler = _completionHandler;
if (handler) {
[self invokeOnCallbackQueueUnlessStopped:^{
handler(data, error); // <-- Error appends here (data is nil)
// Post a notification, primarily to allow code to collect responses for
// testing.
//
// The observing code is not likely on the fetcher's callback
// queue, so this posts explicitly to the main queue.
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
if (data) {
userInfo[kGTMSessionFetcherCompletionDataKey] = data;
}
if (error) {
userInfo[kGTMSessionFetcherCompletionErrorKey] = error;
}
[self postNotificationOnMainThreadWithName:kGTMSessionFetcherCompletionInvokedNotification
userInfo:userInfo
requireAsync:NO];
}];
}
} // @synchronized(self)
}
这是我的代码:
func authUI(_ authUI: FUIAuth, didSignInWith authDataResult: AuthDataResult?, error: Error?) {
if let error = error {
print(error)
return
}
if let authDataResultUser = authDataResult?.user {
authDataResultUser.getIDTokenForcingRefresh(true) { idToken, error in
if error != nil {
print()
return
}
// .....
}
}
}
答案 0 :(得分:1)
这是Firebase iOS SDK的一个错误,此问题现已修复。该修补程序将按照here发布为4.12.1。链接还包含解决方法的说明,直到发布完毕。
或者,如果你想要你的Pod:
我能够在我的项目中成功使用以下版本。我在Podfile
中绑定Firebase库的所有特定版本时遇到了一些问题,而不得不使用.lock
文件。我能够在我的项目中成功使用以下版本。如果您运行pod install
,Cocoapods将解决Podfile.lock
中不存在的任何内容的依赖关系。根据Cocoapods docs,
对于Podfile.lock中列出的pod,它会下载Podfile.lock中列出的显式版本,而不会尝试检查是否有更新的版本
我的建议是尝试使用以下内容替换Podfile.lock
中对Firebase的引用,直到Firebase SDK小组解决了此问题:
PODS:
- Firebase/Auth (4.8.2):
- Firebase/Core
- FirebaseAuth (= 4.4.2)
- Firebase/Core (4.8.2):
- FirebaseAnalytics (= 4.0.9)
- FirebaseCore (= 4.0.14)
- Firebase/Database (4.8.2):
- Firebase/Core
- FirebaseDatabase (= 4.1.4)
- Firebase/DynamicLinks (4.8.2):
- Firebase/Core
- FirebaseDynamicLinks (= 2.3.2)
- Firebase/Firestore (4.8.2):
- Firebase/Core
- FirebaseFirestore (= 0.10.0)
- Firebase/Messaging (4.8.2):
- Firebase/Core
- FirebaseMessaging (= 2.0.8)
- Firebase/Performance (4.8.2):
- Firebase/Core
- FirebasePerformance (= 1.1.1)
- Firebase/Storage (4.8.2):
- Firebase/Core
- FirebaseStorage (= 2.1.2)
- FirebaseAnalytics (4.0.9):
- FirebaseCore (~> 4.0)
- FirebaseInstanceID (~> 2.0)
- "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
- nanopb (~> 0.3)
- FirebaseAuth (4.4.2):
- FirebaseAnalytics (~> 4.0)
- "GoogleToolboxForMac/NSDictionary+URLArguments (~> 2.1)"
- GTMSessionFetcher/Core (~> 1.1)
- FirebaseCore (4.0.14):
- "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
- FirebaseDatabase (4.1.4):
- FirebaseAnalytics (~> 4.0)
- FirebaseCore (~> 4.0)
- leveldb-library (~> 1.18)
- FirebaseDynamicLinks (2.3.2):
- FirebaseAnalytics (~> 4.0)
- FirebaseFirestore (0.10.0):
- FirebaseAnalytics (~> 4.0)
- FirebaseCore (~> 4.0)
- gRPC-ProtoRPC (~> 1.0)
- leveldb-library (~> 1.18)
- Protobuf (~> 3.1)
- FirebaseInstanceID (2.0.8):
- FirebaseCore (~> 4.0)
- FirebaseMessaging (2.0.8):
- FirebaseAnalytics (~> 4.0)
- FirebaseCore (~> 4.0)
- FirebaseInstanceID (~> 2.0)
- GoogleToolboxForMac/Logger (~> 2.1)
- Protobuf (~> 3.1)
- FirebasePerformance (1.1.1):
- FirebaseAnalytics (~> 4.0)
- FirebaseInstanceID (~> 2.0)
- FirebaseSwizzlingUtilities (~> 1.0)
- GoogleToolboxForMac/Logger (~> 2.1)
- "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
- GTMSessionFetcher/Core (~> 1.1)
- Protobuf (~> 3.1)
- FirebaseStorage (2.1.2):
- FirebaseAnalytics (~> 4.0)
- FirebaseCore (~> 4.0)
- GTMSessionFetcher/Core (~> 1.1)
- FirebaseSwizzlingUtilities (1.0.0)
- FirebaseUI (4.5.1):
- FirebaseUI/All (= 4.5.1)
- FirebaseUI/All (4.5.1):
- FirebaseUI/Auth
- FirebaseUI/Database
- FirebaseUI/Facebook
- FirebaseUI/Firestore
- FirebaseUI/Google
- FirebaseUI/Phone
- FirebaseUI/Storage
- FirebaseUI/Twitter
- FirebaseUI/Auth (4.5.1):
- Firebase/Auth (~> 4.2)
- FirebaseUI/Database (4.5.1):
- Firebase/Database (~> 4.0)
- FirebaseUI/Facebook (4.5.1):
- FBSDKLoginKit (~> 4.0)
- FirebaseUI/Auth
- FirebaseUI/Firestore (4.5.1):
- Firebase/Firestore
- FirebaseUI/Google (4.5.1):
- FirebaseUI/Auth
- GoogleSignIn (~> 4.0)
- FirebaseUI/Phone (4.5.1):
- FirebaseUI/Auth
- FirebaseUI/Storage (4.5.1):
- Firebase/Storage (~> 4.0)
- SDWebImage (~> 4.0)
- FirebaseUI/Twitter (4.5.1):
- FirebaseUI/Auth
- TwitterKit (~> 3.0)
答案 1 :(得分:0)
似乎Firebase发现了一个wrokaround。如果您运行pod install
,则会降级一些库:
Installing Firebase 4.5.0 (was 4.12.0)
Installing FirebaseAnalytics 4.0.4 (was 4.1.0)
Installing FirebaseAuth 4.3.1 (was 4.6.0)
Installing FirebaseCore 4.0.10 (was 4.0.19)
Installing FirebaseMessaging 2.0.6 (was 2.2.0)
之后它再次运作。