我一直在尝试使用 PARSE 制作一个应用程序,但我无法运行它,因为我不断收到一条错误消息:
“不能使用类型为 '(String, (Bool, NSError?)) -> ())'' 的参数列表调用 'suscribeToChanelInBackground'”
它指向代码行:
PFPush.subscribeToChannelInBackground((succeeded: Bool, error: NSError?)){
这是在推送通知部分:
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
let installation = PFInstallation.currentInstallation()
installation.setDeviceTokenFromData(deviceToken)
installation.saveInBackground()
PFPush.subscribeToChannelInBackground((succeeded: Bool, error: NSError?)){
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: NSError) {
if error.code == 3010 {
print("Push notifications are not supported in the iOS Simulator.\n")
} else {
print("application:didFailToRegisterForRemoteNotificationsWithError: %@\n", error)
}
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
PFPush.handlePush(userInfo)
if application.applicationState == UIApplicationState.Inactive {
PFAnalytics.trackAppOpenedWithRemoteNotificationPayload(userInfo)
}
}
所以我不知道该怎么做,我一直在网上寻找它,我认为这可能与新的 swift update Swift 2.0(我与 Xcode 7 beta 一起使用)有关是我的代码,还是解析与新的 swift 相关?我已尝试将其注释掉,因为我的应用程序中不需要通知,尽管显然您需要该部分代码,并且我可能不得不在其他地方使用相同的代码,我认为您会这样做。先感谢您。