mercredi 25 février 2015

Parse Facebook logInWithPermissions crash

I'm developing an iOS app with Parse, and implementing Twitter and Facebook login. My code is as follows;



var permissions = NSArray(array: ["user_about_me"])
PFFacebookUtils.logInWithPermissions(permissions, {
(user: PFUser!, error: NSError!) -> Void in
if user == nil {
NSLog("Uh oh. The user cancelled the Facebook login.")
} else if user.isNew {
//Get data and fill in appropriate fields for PFUser
} else {
//login user
}
})


The problem is that when I click the button that runs this code, I get an error with the following text:



Error: Error Domain=PF_AFNetworkingErrorDomain Code=-1016 "Expected content type {(
"text/json",
"application/json",
"text/javascript"
)}, got text/html" UserInfo=0x79faa000 {NSLocalizedRecoverySuggestion=Invalid OAuth Request, PF_AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0x7a174da0> { URL: http://ift.tt/1wAF9pF } { status code: 200, headers {
"Access-Control-Allow-Methods" = "*";
"Access-Control-Allow-Origin" = "*";
Connection = "keep-alive";
"Content-Length" = 21;
"Content-Type" = "text/html; charset=utf-8";
Date = "Sat, 21 Feb 2015 20:12:11 GMT";
Server = "nginx/1.6.0";
"X-Parse-Platform" = G1;
"X-Runtime" = "0.005746";
} }, NSErrorFailingURLKey=http://ift.tt/1wAF9pF, NSLocalizedDescription=Expected content type {(
"text/json",
"application/json",
"text/javascript"
)}, got text/html, PF_AFNetworkingOperationFailingURLRequestErrorKey=<NSMutableURLRequest: 0x7a165300> { URL: http://ift.tt/1wAF9pF }} (Code: 100, Version: 1.6.0)
2015-02-21 14:12:11.851 hotPotato[90663:4004200] Uh oh. The user cancelled the Facebook login.


It appears that something about my "permissions" array is not correct. However, I think I've followed Parse's instructions exactly save the fact that I am translating into swift. Any ideas?


Aucun commentaire:

Enregistrer un commentaire