OAuth2 登录使用 gtm-oauth-2,而不是 google-api-objc-client
OAuth2 login working with gtm-oauth-2, not with google-api-objc-client
我先实现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。现在,我收到以下错误:
2015-02-25 17:10:10.782 Reset[17368:76612] Invalid parameter not satisfying: windowNibPath
我正在使用这段代码(我尝试使用 obj-c,得到了同样的错误):
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
})
两天以来我一直在努力理解为什么。有什么想法吗?
编辑:我 created a repo 重现了错误。
必须修改文件 OAuth2/Mac/GTMOAuth2WindowController.m
第 117-118 行
NSString *nibPath = [bundle pathForResource:nibName ofType:@"nib"];
self = [super initWithWindowNibPath:nibPath owner:self];
来自
self = [super initWithWindowNibName:nibName owner:self];
看起来像库的使用和旧的初始化方法 window。希望这可以帮助某人。
我先实现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。现在,我收到以下错误:
2015-02-25 17:10:10.782 Reset[17368:76612] Invalid parameter not satisfying: windowNibPath
我正在使用这段代码(我尝试使用 obj-c,得到了同样的错误):
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
})
两天以来我一直在努力理解为什么。有什么想法吗?
编辑:我 created a repo 重现了错误。
必须修改文件 OAuth2/Mac/GTMOAuth2WindowController.m
第 117-118 行
NSString *nibPath = [bundle pathForResource:nibName ofType:@"nib"];
self = [super initWithWindowNibPath:nibPath owner:self];
来自
self = [super initWithWindowNibName:nibName owner:self];
看起来像库的使用和旧的初始化方法 window。希望这可以帮助某人。