Charlbury
Charlbury

Reputation: 13

Parse.com starter project gives Cannot invoke 'subscribeToChannelInBackground' compiler error on xcode 6.3

If I simply download the starter project, open it in xcode 6.3, update the setApplicationID line and run it, as it says to on the Quickstart screens, i get the error

Cannot invoke 'subscribeToChannelInBackground' with an argument list of type '(String, block: (Bool, NSError!) -> Void)'

in AppDelegate.swift.

Is there a problem with the latest version of Swift or/and Xcode or have I missed something?

Upvotes: 0

Views: 483

Answers (1)

Michael Lee
Michael Lee

Reputation: 630

As RaVeN said, NSError has been changed in Swift 1.2 to be optional. Therefore, go to where the error is happening, the subscribeToChannelInBackground.

Change this:

        PFPush.subscribeToChannelInBackground("", block: { (succeeded: Bool, error: NSError!)

To this:

        PFPush.subscribeToChannelInBackground("", block: { (succeeded: Bool, error: NSError?)

You should be able to compile now without problem.

Upvotes: 1

Related Questions