【发布时间】:2015-07-13 13:46:35
【问题描述】:
我正在使用适用于 IOS 的 Google Calendar API。我已经桥接了它,以便我可以快速使用它。在调用回调之前,授权一直有效(即我可以在我的 Google 帐户中看到授权已发生)。
在their example 中,他们有一个选择器来处理成功的身份验证,如下所示。
// Handle completion of the authorization process, and update the Google Calendar API
// with the new credentials.
- (void)viewController:(GTMOAuth2ViewControllerTouch *)viewController
finishedWithAuth:(GTMOAuth2Authentication *)authResult
error:(NSError *)error {
//...
}
我已将这个选择器翻译如下...
func finishedAuthorisation(viewController:GTMOAuth2ViewControllerTouch?, authResult:GTMOAuth2Authentication?, error:NSError?){
//...
}
...并像这样使用它...
GTMOAuth2ViewControllerTouch(scope: " ".join(scopes), clientID: kClientID, clientSecret: kClientSecret, keychainItemName: kKeychainItemName, delegate: self, finishedSelector: "finishedAuthorisation:")
...导致此错误
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSInvocation _invocationWithMethodSignature:frame:]: method signature argument cannot be nil'
我在这里做错了什么?
【问题讨论】:
-
阅读 this nice answer 和 this - 向下滚动到 Objective-C 选择器。
标签: ios objective-c iphone swift ipad