Search code examples
objective-cmacosswiftoauthgtm-oauth2

OAuth2 login working with gtm-oauth-2, not with google-api-objc-client


I first implement gtm-oauth2 on my app to test the OAuth login with Google. Then, as I need access to Google Calendar, I delete gtm-oauth2 and I've installed google-api-objectivec-client. Now, I get the following error :

2015-02-25 17:10:10.782 Reset[17368:76612] Invalid parameter not satisfying: windowNibPath

I'm using this code (I tried with obj-c, got the same error):

let controller = GTMOAuth2WindowController(
    scope: "https://www.googleapis.com/auth/calendar",
    clientID: "aze",
    clientSecret: "aze",
    keychainItemName: "aze",
    resourceBundle: nil
)

controller.signInSheetModalForWindow(mainWindow, completionHandler: { (auth: GTMOAuth2Authentication!, error: NSError!) -> Void in
        Context.shared.user.auth = auth
})

I try to understand why since two days. Any idea ?

EDIT : I've created a repo which reproduce the error.


Solution

  • Had to modify the file OAuth2/Mac/GTMOAuth2WindowController.m line 117-118

    NSString *nibPath = [bundle pathForResource:nibName                                                                                        ofType:@"nib"];
    self = [super initWithWindowNibPath:nibPath owner:self];
    

    by

    self = [super initWithWindowNibName:nibName owner:self];
    

    Looks like the library use and old way to init window. Hope this can help someone.