Quickblox: an issue in deleting content item (picture file / blob) - ios

I am having a weird issue when I try to delete a content item (picture blob item for the user), stored as PNG picture file in the back-end database.
The delete proceeds without errors, but gives "422 Unprocessable Entity". What does this mean? The status of the content item seems to be OK and ready when checked in Quickblox admin panel.
I have uploaded the content with following API call:
[QBContent TUploadFile:imageData fileName:#"profile.png" contentType:#"image/png" isPublic:YES delegate:self];
I am trying to delete the object with following API call:
[QBContent deleteBlobWithID:blobID delegate:self];
QB logs:
Performing async request:
DELETE http://api.quickblox.com/blobs/91049.xml
headers:{
"QB-SDK" = "iOS 1.8";
"Qb-Token" = b9e3d1cc708c8444070544df8c642ad194509e67;
"QuickBlox-REST-API-Version" = "0.1.1";
}
parameters:
2013-12-12 14:33:52.328 QBTestApp[21095:6b73] Request finished, response:
headers:{
"Access-Control-Allow-Origin" = "*";
"Cache-Control" = "no-cache";
Connection = "keep-alive";
"Content-Length" = 49;
"Content-Type" = "application/xml; charset=utf-8";
Date = "Thu, 12 Dec 2013 13:33:58 GMT";
"QB-Token-ExpirationDate" = "2013-12-12 15:32:22 UTC";
"QuickBlox-REST-API-Version" = "0.1.1";
Server = "nginx/1.0.15";
Status = "422 Unprocessable Entity";
"X-Rack-Cache" = "invalidate, pass";
"X-Request-Id" = 3f235134e5aa0bd012ef78e54cddc164;
"X-Runtime" = "0.039680";
"X-UA-Compatible" = "IE=Edge,chrome=1";
}
body:
error:
<?xml version="1.0" encoding="UTF-8"?>
<errors/>
Any ideas what I might be doing wrong here? Thanks (again) in advance! :-)

The feeling that you are trying to delete a blob file that does not exisе. Please make sure that you are trying to delete a blob file after the upload and the creation process is completed(calling completedWithResult: with successful result).
If I could see the order of method calls TUploadFile: and deleteBlobWithID: in the code, I could help you more quickly.

Related

QuickBlox v2.6 Facebook login issue

I have one issue facebook signing with quickblox api.
After getting AccessToken by using FBSDK.
[QBRequest logInWithSocialProvider:#"facebook" accessToken:accessToken accessTokenSecret:nil successBlock:^(QBResponse *response, QBUUser *user) {
} errorBlock:^(QBResponse *response) {}
i think facebook returns correct token string.
CAAVS4qDIQb4BAMS7pTl3P1EmtW1ZCOOpbTCQFWrBI8QsA7ufOTYapjF3rEpW1ojZChgOZB7mj6AWDocDSdtxFbksqP3FyZCIou6bUC6ON4ZCRFGPes6TBzufh68A9fBSSz6baTYCZCTIyZAoDhYdBZAvrHF3609cAiEZCesnWrtqYleqPv7YHIadrWf2x1oWItypF3V3pbDgsHd7MSSCcZBvK4yuHGeCUvf7qMPFznuRZCfwNCOcQBDU8ynHnzDPpnnhLEZD
[logInWithSocialProvider: accessToken: ...] function returns following error
[QBResponse], status: 422
2015-12-09 14:27:27.049 NudgeBuddies[2598:124844] [QBCore] Response error: Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: client error (422)" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x7ffde266ce40> { URL: https://api.quickblox.com/login.json } { status code: 422, headers {
"Access-Control-Allow-Origin" = "*";
"Cache-Control" = "no-cache";
Connection = "keep-alive";
"Content-Length" = 47;
"Content-Type" = "application/json; charset=utf-8";
Date = "Wed, 09 Dec 2015 06:27:26 GMT";
"QB-Token-ExpirationDate" = "2015-12-09 08:27:26 UTC";
"QuickBlox-REST-API-Version" = "0.1.1";
Server = "nginx/1.6.2";
Status = "422 Unprocessable Entity";
"X-Rack-Cache" = "invalidate, pass";
"X-Request-Id" = ab3443c24c0d5ee0a18d796eaf996cb7;
"X-Runtime" = "0.221723";
"X-UA-Compatible" = "IE=Edge,chrome=1";
} }, NSErrorFailingURLKey=https://api.quickblox.com/login.json, com.alamofire.serialization.response.error.data=<7b226572 726f7273 223a7b22 62617365 223a5b22 4c6f6769 6e206f72 20656d61 696c2072 65717569 72656422 5d7d7d>, NSLocalizedDescription=Request failed: client error (422)}
Please Help me.
How can i solve this problem?
Regards.
In QuickBlox SDK 2.6.5 we have improved stability and we have enabled detail logging so you are able to see the reasons why problem happens.
QuickBlox has open source project Q-municate with Facebook login and you can check it by yourself.
Thanks!

iOS App Signup Error

I receive this error when I tried to signup an account with the app im building. May I know what does this error means? Thank you!
BaseNetworkManager.m:164 Error Domain=AFNetworkingErrorDomain Code=-1011
"Expected status code in (200-299), got 500" UserInfo=0x16d30560
{NSLocalizedRecoverySuggestion=meta http-equiv="refresh" content="0;
url =websitelink.error.html"
AFNetworkingOperationFailingURLRequestErrorKey=NSMutableURLRequest: 0x16670d80> { URL: mywebsite/users.json }, NSErrorFailingURLKey=h mywebsite.com/users.json, NSLocalizedDescription=Expected status code in (200-299), got 500, AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0x1669fe20> { URL: mywebsite.com/users.json } { status code: 500, headers {
Connection = "keep-alive";
"Content-Length" = 690;
"Content-Type" = "text/html; charset=utf-8";
Date = "Fri, 01 May 2015 12:37:44 GMT";
Server = Cowboy;
Status = "500 Internal Server Error";
Via = "1.1 vegur";
"X-Rack-Cache" = "invalidate, pass";
"X-Request-Id" = "tyud";
"X-Runtime" = "5.087065"; } }}
2015-05-01 20:37:45.002 appname[1677:60b] <BaseNetworkManager.m:165> (null)
The server is telling you
500 Internal Server Error
this means that the server has a problem that is not your fault. (unless you are the one who is responsible for the server.)
HTTP 200..299 means "ok"
HTTP 300..399 means "look somewhere else"
HTTP 400..499 means "there is a problem with your request." for example 404=file not found, 403=forbidden, etc.
HTTP 500..599 means "the server has a problem / is misconfigured"
see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more info.

Instagram API, AFNetworking 2.0 iOS client 400 error

I haven't changed anything in my app and my code seems to generate the proper URL with access token attached, but I am getting a 400 error bad request for the past day. It doesn't seem as if Instagram has changed the endpoint. Can someone help me decipher the error log to see if there is any usable info here to help me debug? Access Token x'd out.
Failure Error Domain=AFNetworkingErrorDomain Code=-1011 "Request failed: bad request (400)"
UserInfo=0x9261450 {NSErrorFailingURLKey=https://api.instagram.com/v1/locations/search?lat=37.785834&lng=-122.406417&distance=50&access_token=XXXX, AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0x92627d0> { URL: https://api.instagram.com/v1/locations/search?lat=37.785834&lng=-122.406417&distance=50&access_token=XXXX }
{ status code: 400, headers {
"Cache-Control" = "private, no-cache, no-store, must-revalidate";
Connection = "keep-alive";
"Content-Language" = en;
"Content-Type" = "application/json; charset=utf-8";
Date = "Tue, 26 Aug 2014 05:19:53 GMT";
Expires = "Sat, 01 Jan 2000 00:00:00 GMT";
Pragma = "no-cache";
Server = nginx;
"Set-Cookie" = "csrftoken=26b1980509fc8303e630689c2d483074; expires=Tue, 25-Aug-2015 05:19:53 GMT; Max-Age=31449600; Path=/, ccode=US; Path=/";
"Transfer-Encoding" = Identity;
Vary = "Cookie, Accept-Language";
"X-Ratelimit-Limit" = 5000;
"X-Ratelimit-Remaining" = 4999;
} }, NSLocalizedDescription=Request failed: bad request (400)}

Request gives error "connect closed due to timeout"

I am using quickblox in my app
I am trying to retrieve a dialog with certain user IDs
NSMutableDictionary *dict = [[NSMutableDictionary alloc]init];
[dict setObject:#"occupants_ids" forKey:#[#([[[DataManager sharedCenter]chat_user]ID]), #(self.opponent.ID)]];
[QBChat dialogsWithExtendedRequest:dict delegate:self];
and the result is this:
2014-08-09 13:47:02.843 App New[8752:8e0b] Performing async request:
GET https://api.quickblox.com/chat/Dialog.xml
headers:{
"QB-SDK" = "iOS 1.9.1";
"Qb-Token" = verylongtokencensored;
"QuickBlox-REST-API-Version" = "0.1.1";
}
parameters:{
(
1434093,
1367118
) = "occupants_ids";
}
2014-08-09 13:47:02.848 App New[8752:8e0b] Request finished, response:
headers:{
"Access-Control-Allow-Origin" = "*";
"Cache-Control" = "max-age=0, private, must-revalidate";
Connection = "keep-alive";
"Content-Type" = "application/xml; charset=utf-8";
Date = "Sat, 09 Aug 2014 10:47:02 GMT";
Etag = "\"0c1aa29ff51b425a9be969d4fbb487a1\"";
"QB-Token-ExpirationDate" = "2014-08-09 12:47:02 UTC";
"QuickBlox-REST-API-Version" = "0.1.1";
Server = "nginx/1.0.15";
Status = "201 Created";
"Transfer-Encoding" = Identity;
"X-Rack-Cache" = "invalidate, pass";
"X-Request-Id" = 2330d50ea8c08851cafd30ea4c1a1c6b;
"X-Runtime" = "0.022278";
"X-UA-Compatible" = "IE=Edge,chrome=1";
}
body:
<?xml version="1.0" encoding="UTF-8"?>
<session>
<_id>53e5fc26535c12a2f700aa3c</_id>
<application-id type="integer">10910</application-id>
<created-at type="datetime">2014-08-09T10:47:02Z</created-at>
<device-id type="integer">0</device-id>
<nonce type="integer">399</nonce>
<token>verylongtokencensored</token>
<ts type="integer">1407581207</ts>
<updated-at type="datetime">2014-08-09T10:47:02Z</updated-at>
<user-id type="integer">1434093</user-id>
<id type="integer">54616</id>
</session>
error:
2014-08-09 13:47:02.852 App New[8752:60b] received result:QBDialogsPagedResult,success:0,status:0
2014-08-09 13:47:02.852 App New[8752:8e0b] Request finished, response:
headers:(null)
body:
error:
2014-08-09 13:47:02.853 App New[8752:60b] Errors=(
"Connection closed due to timeout. Please check your internet connection."
)
How do i fix this error ?
Other requests sent to the api, which is not /chat/Dialog.xml they work fine, no connection timeout error
The right way is to use filter all:
[dict setObject:#"33,55" forKey:#"occupants_ids[all]"];
this will found all the dialogs where occupants_ids = "33,55"
you also can use filter in:
[dict setObject:#"33" forKey:#"occupants_ids[in]"];
this will return all the dialogs where occupants_ids contains 33
my bad my request had setObject forKey turned around, it should have been
[dict setObject:#[#([[[DataManager sharedCenter]chat_user]ID]), #(self.opponent.ID)] forKey:#"occupants_ids" ];

QuickBlox after some time Sender become receiver and receiver become Sender

i am using QuickBlox Simple Chat for how to know how it was working.
In demo ex.2 user first is USER1 and Other is USER2.
After some time USER1 message display in table where the side of USER2 message and USER2 message is display in side of USER1 messages.
Get a response to the server like this
Request finished, response:
RestResponse:
------
<QBASIHTTPRequest: 0xa288c00>
headers:{
"Access-Control-Allow-Origin" = "*";
"Cache-Control" = "no-cache";
Connection = Close;
"Content-Length" = 106;
"Content-Type" = "application/xml; charset=utf-8";
Date = "Sat, 05 Oct 2013 05:54:05 GMT";
"QB-Token-ExpirationDate" = "2013-10-05 07:53:46 UTC";
"QuickBlox-REST-API-Version" = "0.1.1";
Server = "nginx/1.0.15";
Status = "422 Unprocessable Entity";
"X-Rack-Cache" = "invalidate, pass";
"X-Request-Id" = c70e07ac0a8571253773cde59c23676c;
"X-Runtime" = "0.223264";
"X-UA-Compatible" = "IE=Edge,chrome=1";
}
body:<?xml version="1.0" encoding="UTF-8"?>
<errors>
<error>No one can receive the message</error>
</errors>
error:

Resources