【发布时间】:2017-05-05 22:06:26
【问题描述】:
我已经下载了 ParseStarterProject 版本 1.14.3,下载后它要求我转换为 swift 3。之后给我一个错误:
Cannot convert value of type '(Bool, NSError?) -> ()' to expected argument type 'PFBooleanResultBlock?'
代码:
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)
}
} as! PFBooleanResultBlock as! PFBooleanResultBlock as! PFBooleanResultBlock as! PFBooleanResultBlock as! PFBooleanResultBlock as! PFBooleanResultBlock as! PFBooleanResultBlock
}
我尝试用另一个线程解决 (AppDelegate.swift function returning errors after converting to swift 3 (cannot convert to PFBooleanResultBlock?)?)
但是给了我这个错误:
"Expected ) in the expression list"
【问题讨论】:
-
7
as! PFBooleanResultBlock的列表是错字吗?为什么要投射到那种类型? -
这是 Xcode 自动转换为 swift 3...但即使没有那个错字它也不起作用。
-
看起来你的确切问题已经在这里解决了:stackoverflow.com/a/39684760/6658553
-
我看到并尝试过,但它也不起作用。
标签: swift facebook parse-platform swift3 parse-server