Quickblox Swift - 通过 Phone 号码请求用户
Quickblox Swift - Requesting Users by Phone Number
在我的 iPhone 应用程序中,我试图在注册时查看输入的 phone 号码是否已附加到应用程序内的当前用户。
我可以验证我的文本字段条目与应用程序中用户的 phone 号码相同,但是以下函数总是 returns 错误:
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)}
看来您遇到了类似的问题。请参考this link。
在我的 iPhone 应用程序中,我试图在注册时查看输入的 phone 号码是否已附加到应用程序内的当前用户。
我可以验证我的文本字段条目与应用程序中用户的 phone 号码相同,但是以下函数总是 returns 错误:
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)}
看来您遇到了类似的问题。请参考this link。