我最近将我的应用程序从之前版本的swift转换为swift 3.0(并且还获得了最新版本的Xcode),并且在许多其他错误中,我收到了以下一个:
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let installation = PFInstallation.current()
installation.setDeviceTokenFrom(deviceToken)
installation.saveInBackground()
PFPush.subscribeToChannel(inBackground: "") { (succeeded: Bool, error: NSError?) in
if succeeded {
print("ParseStarterProject successfully subscribed to push notifications on the broadcast channel.\n");
} else {
print("ParseStarterProject failed to subscribe to push notifications on the broadcast channel with error = %@.\n", error)
}
}
}
Run Code Online (Sandbox Code Playgroud)
这来自我作为模板下载的SDK(PF指的是Parse框架......我使用的是Heroku托管的Parse服务器).返回错误说:"无法将类型的值'(Bool,NSError?) - >()'转换为预期的参数类型'PFBooleanResultBlock?'"
不知道如何解决这个问题.有人有什么想法吗?
小智 5
我相信你可以改变你的代码:
PFPush.subscribeToChannel(inBackground: "", block: {(succeeded, error) -> Void in
if succeeded {
print("ParseStarterProject successfully subscribed to push notifications on the broadcast channel.\n");
} else {
print("ParseStarterProject failed to subscribe to push notifications on the broadcast channel with error = %@.\n", error)
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
697 次 |
| 最近记录: |