Quickblox Swift - 通过电话号码请求用户

时间:2016-05-07 03:29:02

标签: swift quickblox

在我的iPhone应用程序中,如果输入的电话号码已经附加到应用程序中的当前用户,我正在尝试注册。

我可以验证我的文本字段条目是否与用户在应用程序中的电话号码相同,但以下函数始终会返回错误:

QBRequest.usersWithPhoneNumbers([self.mobileNumberTextField.text!], successBlock: { (response: QBResponse, page: QBGeneralResponsePage?, user: [QBUUser]?) in

     print("user")

}, errorBlock: { (response: QBResponse) in

     print("no user")
})

以下是错误输出:

error: Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: forbidden (403)" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x138057340> { URL: http://apixxxxxxxxxxx.quickblox.com/users.json?filter%5B%5D=string%20phone%20in%20306xxxxxxx } { status code: 403, headers {
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = "no-cache";
    Connection = "keep-alive";
    "Content-Type" = "application/json; charset=utf-8";
    Date = "Sat, 07 May 2016 03:22:31 GMT";
    "QB-Token-ExpirationDate" = "2016-05-07 05:22:29 UTC";
    "QuickBlox-REST-API-Version" = "0.1.1";
    Server = "nginx/1.8.1";
    Status = "403 Forbidden";
    "Transfer-Encoding" = Identity;
    "X-Rack-Cache" = miss;
    "X-Request-Id" = 331b0f8f7a18f5aff16fea6f13cedffc;
    "X-Runtime" = "0.018348";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
} }, NSErrorFailingURLKey=http://apixxxxxx.quickblox.com/users.json?filter[]=string%20phone%20in%20306xxxxxx, com.alamofire.serialization.response.error.data=<7b226572 726f7273 223a7b22 62617365 223a5b22 55736572 73207265 74726965 76696e67 20666f72 62696464 656e2069 6e206164 6d696e20 70616e65 6c2c2061 70706c69 63617469 6f6e2073 65747469 6e67732e 20536574 75702069 74206865 72652068 74747073 3a2f2f61 646d696e 71622d63 68617474 65722e71 7569636b 626c6f78 2e636f6d 2f617070 732f3332 3936382f 73657474 696e6773 225d7d7d>, NSLocalizedDescription=Request failed: forbidden (403)}

1 个答案:

答案 0 :(得分:2)

看起来你有类似的问题。请参阅this link