2016-09-27 1 views
5

Google 로그인이 Xcode 7에서 잘 작동합니다. Xcode 8로 업데이트 한 후 오류가 발생했습니다 : Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'You must specify |clientID| for |GIDSignIn|'. 내 CLIENT_ID가있는 GoogleService-Info.plist 파일이 있습니다. | clientID |를 지정해야합니다. | GIDSignIn | Google과 로그인 할 때 오류가 발생했습니다.

나는 다음 줄을 추가하여 문제를 해결할 수 있었다 :

GIDSignIn.sharedInstance().clientID = "<CLIENT_ID>" 

는 CLIENT_ID가 GoogleService-의 Info.plist에서 인출되지 않는 것 같다. Copy Bundle Resources에 있는지 확인했습니다.

enter image description here

나는 코드에서 클라이언트 ID를 지정할 필요가 없습니다. GoogleService-Info.plist 파일의 정보를 얻으려면 어떻게 수정해야합니까?

답변

1

나는 동일한 문제가있었습니다. 필자의 경우 실제로 GoogleServices-Info.plist이 업데이트되었습니다. GoogleServices-Info.plist을 다시 다운로드하여 문제를 해결 한 이전 버전으로 업데이트했습니다.

0

내가 AppDelegate에 클래스에 잊어 코드를 추가하여 그것을 해결 :

#import "AppDelegate.h" 
#import <Google/SignIn.h>  

@interface AppDelegate()<GIDSignInDelegate> 

@end 

@implementation AppDelegate 

#pragma mark - UIApplicationDelegate 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    //Google sign-in setup 
    NSError* configureError; 
    [[GGLContext sharedInstance] configureWithError: &configureError]; 
    if (configureError) { 
     NSLog(@"Error configuring Google services: %@", configureError.localizedDescription); 
    } 

    [GIDSignIn sharedInstance].delegate = self; 

    return YES; 
} 


#pragma mark - GIDSignInDelegate 

- (void)signIn:(GIDSignIn *)signIn didSignInForUser:(GIDGoogleUser *)user withError:(NSError *)error { 
    //add your code here 
} 

- (void)signIn:(GIDSignIn *)signIn didDisconnectWithUser:(GIDGoogleUser *)user withError:(NSError *)error { 
    //add your code here 
} 

@end 
6

당신은 이런 식으로 할 수 있습니다. AppDelegate에의

GIDSignIn.sharedInstance().clientID = FIRApp.defaultApp()?.options.clientID 
+0

FirebaseApp.configure()를 실행 한 후 AppDelegate 파일에이 것을 씁니다. – hussain

0

빠른 3 추가 :

var configureError: NSError? 
GGLContext.sharedInstance().configureWithError(&configureError) 
assert(configureError == nil, "Error configuring Google services: \ 
(String(describing: configureError))") 
0

당신이 순서대로 이러한 코드 장소가 있는지 확인하십시오.

FirebaseApp.configure() 

GIDSignIn.sharedInstance().clientID = FirebaseApp.app()?.options.clientID 
GIDSignIn.sharedInstance().delegate = self 

FirebaseApp.app()?.options.clientIDFirebaseApp.configure()가 호출 된 후 GoogleService-의 Info.plist에서 데이터를 얻을에만 수 것입니다.

관련 문제