解析Facebook logInWithPermissions崩溃

时间:2015-02-21 20:18:15

标签: ios facebook parse-platform

我正在开发一个使用Parse的iOS应用程序,并实现Twitter和Facebook登录。我的代码如下;

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
      }
    })

问题是,当我单击运行此代码的按钮时,出现以下文本的错误:

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: https://api.parse.com/2/user_signup_or_login } { 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=https://api.parse.com/2/user_signup_or_login, NSLocalizedDescription=Expected content type {(
    "text/json",
    "application/json",
    "text/javascript"
)}, got text/html, PF_AFNetworkingOperationFailingURLRequestErrorKey=<NSMutableURLRequest: 0x7a165300> { URL: https://api.parse.com/2/user_signup_or_login }} (Code: 100, Version: 1.6.0)
2015-02-21 14:12:11.851 hotPotato[90663:4004200] Uh oh. The user cancelled the Facebook login.

看来我的&#34;权限&#34;数组不正确。但是,我想我已经跟着Parse&#39; s instructions完全保存了我正在翻译成快速的事实。有什么想法吗?

2 个答案:

答案 0 :(得分:1)

这是版本1.6.2及更低版本中的错误。将您的解析框架更新为1月20日发布的1.6.3,它应该清除您的问题。

答案 1 :(得分:0)

Error: Error Domain=PF_AFNetworkingErrorDomain Code=-1016 "Expected content type {(
    "text/json",
    "application/json",
    "text/javascript"
)}, got text/html"

您收到的回复内容类型为text / html,但错误消息显示应该是text / json,application / json或text / javascript。将text / html添加到接受/允许的内容类型。