重构Swift 3后,我有Google Cloud Messaging
(GCM
)这个问题。任何人都可以帮忙吗?无法将类型'(String !, NSError!) - >()'的值转换为期望的参数类型'GGLInstanceIDTokenHandler!'
我得到这个错误: 无法将类型'(String !, NSError!) - >()'的值转换为期望的参数类型'GGLInstanceIDTokenHandler!'
这里:
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
// ...
GGLInstanceID.sharedInstance().tokenWithAuthorizedEntity(gcmSenderID, scope: kGGLInstanceIDScopeGCM, options: registrationOptions, handler: registrationHandler)
}
而且同样的错误在这里:
func onTokenRefresh() {
GGLInstanceID.sharedInstance().token(withAuthorizedEntity: gcmSenderID, scope: kGGLInstanceIDScopeGCM, options: registrationOptions, handler: registrationHandler)
}
这是registrationHandler:
func registrationHandler(_ registrationToken: String!, error: NSError!) {
// ...
}
它看起来像'registrationHandler'的签名已更改。重新输入方法以获得代码完成时的实际签名。 – vadian
@vadian:它显示registrationHandler被depricated :( – Kaptain
然后查看替换的文档。 – vadian