I have been trying to make an app with PARSE but I can't run it because I keep getting an error saying :
"Cannot invoke 'suscribeToChanelInBackground' with an argument list of type '(String, (Bool , NSError?)) -> ())''"
And it is pointing to the line of code:
PFPush.subscribeToChannelInBackground((succeeded: Bool, error: NSError?)){
Which is in the Push Notifications Section:
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)
}
}
So I can't figure out what to do, I have been looking all over the web about it and I think it might be something to be to do with the new swift update Swift 2.0 (which I am using along with Xcode 7 beta) Is it my code , or parse's to do with the new swift? I have tried commenting it out because I don't need notifications in my app though apparently you need that section of code, and I might have to use the same code somewhere else which I think you do. Thank you in advance.