Swift 3的分析入门工具包
我已经下载了ParseStarterProject版本1.14.3,下载后它要求我转换为swift 3。在这之后,我得到了一个错误:Swift 3的分析入门工具包,swift,facebook,parse-platform,swift3,parse-server,Swift,Facebook,Parse Platform,Swift3,Parse Server,我已经下载了ParseStarterProject版本1.14.3,下载后它要求我转换为swift 3。在这之后,我得到了一个错误: Cannot convert value of type '(Bool, NSError?) -> ()' to expected argument type 'PFBooleanResultBlock?' 代码: 我试着用另一个线程解决() 但给了我一个错误: "Expected ) in the expression list" 我试图重现相同的错
Cannot convert value of type '(Bool, NSError?) -> ()' to expected argument type 'PFBooleanResultBlock?'
代码:
我试着用另一个线程解决()
但给了我一个错误:
"Expected ) in the expression list"
我试图重现相同的错误,我只是用以下代码替换swift3生成的代码:
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let installation = PFInstallation.current()
installation?.setDeviceTokenFrom(deviceToken)
installation?.saveInBackground()
PFPush.subscribeToChannel(inBackground: "") { (succeeded, error) 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)
}
}
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
if error._code == 3010 {
print("Push notifications are not supported in the iOS Simulator.\n")
} else {
print("application:didFailToRegisterForRemoteNotificationsWithError: %@\n", error)
}
}
A它起作用了
我的项目是是7个
的列表!PFBooleanResultBlock
输入错误?你为什么要转换成那个类型?它是Xcode自动转换成swift 3…但即使没有那个打字错误,它也不起作用。看起来你的确切问题已经在这里解决了:可能是重复的我看到了,并尝试过,但它也不起作用。谢谢!!大多数人只是投了反对票,因为他们甚至没有检查斯威夫特是否再次改变,有一个新的问题,你可以解决它。再次感谢你。@RenatoPimpão这是真的!朱利安,这个简单的“错误代码”救了我一天。我已经找到了如何管理可选的everywhere,但没有结果。我不得不忽略一个code=1的值,但是分解这个错误对象看起来很古怪。我无法理解为什么苹果会做出一些简单的事情,比如错误代码这么难。
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let installation = PFInstallation.current()
installation?.setDeviceTokenFrom(deviceToken)
installation?.saveInBackground()
PFPush.subscribeToChannel(inBackground: "") { (succeeded, error) 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)
}
}
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
if error._code == 3010 {
print("Push notifications are not supported in the iOS Simulator.\n")
} else {
print("application:didFailToRegisterForRemoteNotificationsWithError: %@\n", error)
}
}