Question

I am using QuickBlox for my chatting app. The app turns black screen sometimes.

New LOG:

2014-01-24 01:54:42.302 Chat[5670:310b] Performing async request: 

POST http://api.quickblox.com/session.xml

headers:{
    "QB-SDK" = "iOS 1.8";
    "Qb-Token" = 5b25119abfa4c89aced5068a1b2d151b19b77e86;
    "QuickBlox-REST-API-Version" = "0.1.1";
}

parameters:{
    "application_id" = 4354;
    "auth_key" = yYBXmUnyvpYPMe5;
    nonce = 125;
    signature = a65c0971fa81ca8c79805b3ed4d7052e0ee5c059;
    timestamp = 1390499682;
}
2014-01-24 01:54:42.352 Chat[5670:7b1b] -[QBChat xmppStream:didSendPresence:] -> Presence: <presence/>
2014-01-24 01:54:42.352 Chat[5670:60b] chatDidFailWithError: 1
2014-01-24 01:54:42.353 Chat[5670:7b1b] QBChat/didDisconnect, error: Error Domain=GCDAsyncSocketErrorDomain Code=7 "Socket closed by remote peer" UserInfo=0x1565dbe0 {NSLocalizedDescription=Socket closed by remote peer}
2014-01-24 01:54:43.031 Chat[5670:60b] result is: <QBAAuthSessionCreationResult: 0x155830c0>
2014-01-24 01:54:43.032 Chat[5670:7b1b] Request finished, response:

headers:{
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = "max-age=0, private, must-revalidate";
    Connection = "keep-alive";
    "Content-Length" = 524;
    "Content-Type" = "application/xml; charset=utf-8";
    Date = "Thu, 23 Jan 2014 17:54:41 GMT";
    Etag = "\"3472cc7b5b8d9c8d5fff89fbfdb73931\"";
    "QB-Token-ExpirationDate" = "2014-01-23 19:54:41 UTC";
    "QuickBlox-REST-API-Version" = "0.1.1";
    Server = "nginx/1.0.15";
    Status = "201 Created";
    "X-Rack-Cache" = "invalidate, pass";
    "X-Request-Id" = 2048340bfb6b9a87dd400a79a4b0a40c;
    "X-Runtime" = "0.014610";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

body:

<?xml version="1.0" encoding="UTF-8"?>
<session>
  <_id>52e15761535c120d6e00523d</_id>
  <application-id type="integer">4354</application-id>
  <created-at type="datetime">2014-01-23T17:54:41Z</created-at>
  <device-id type="integer">0</device-id>
  <nonce type="integer">125</nonce>
  <token>8564a56a8744464e61afdbb370c2d02cc3d940a6</token>
  <ts type="integer">1390499682</ts>
  <updated-at type="datetime">2014-01-23T17:54:41Z</updated-at>
  <user-id type="integer">0</user-id>
  <id type="integer">31413</id>
</session>
error:

2014-01-24 01:54:43.042 Chat[5670:7b1b] Performing async request: 

POST http://api.quickblox.com/login.xml

headers:{
    "QB-SDK" = "iOS 1.8";
    "Qb-Token" = 8564a56a8744464e61afdbb370c2d02cc3d940a6;
    "QuickBlox-REST-API-Version" = "0.1.1";
}

parameters:{
    login = hehe;
    password = 12345678;
}
2014-01-24 01:54:43.741 Chat[5670:7b1b] Request finished, response:

headers:{
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = "no-cache";
    Connection = "keep-alive";
    "Content-Length" = 590;
    "Content-Type" = "application/xml; charset=utf-8";
    Date = "Thu, 23 Jan 2014 17:54:41 GMT";
    "QB-Token-ExpirationDate" = "2014-01-23 19:54:41 UTC";
    "QuickBlox-REST-API-Version" = "0.1.1";
    Server = "nginx/1.0.15";
    Status = "202 Accepted";
    "X-Rack-Cache" = "invalidate, pass";
    "X-Request-Id" = eab9d8949c044d1af3b0282222931428;
    "X-Runtime" = "0.015342";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

body:

<?xml version="1.0" encoding="UTF-8"?>
<user>
  <blob-id type="integer" nil="true"/>
  <created-at type="datetime">2014-01-23T15:47:06Z</created-at>
  <email nil="true"/>
  <external-user-id type="integer" nil="true"/>
  <facebook-id nil="true"/>
  <full-name nil="true"/>
  <id type="integer">806773</id>
  <last-request-at type="datetime" nil="true"/>
  <login>hehe</login>
  <owner-id type="integer">5464</owner-id>
  <phone nil="true"/>
  <twitter-id nil="true"/>
  <updated-at type="datetime">2014-01-23T15:47:06Z</updated-at>
  <website nil="true"/>
  <user-tags nil="true"/>
</user>
error:

2014-01-24 01:54:43.749 Chat[5670:7b1b] -[QBChat loginWithUser:] -> Chat server endpoint: muc.chat.quickblox.com, User JID: 806773-4354@chat.quickblox.com
2014-01-24 01:54:43.770 Chat[5670:7b1b] Performing async request: 

POST http://api.quickblox.com/push_tokens.xml

headers:{
    "QB-SDK" = "iOS 1.8";
    "Qb-Token" = 8564a56a8744464e61afdbb370c2d02cc3d940a6;
    "QuickBlox-REST-API-Version" = "0.1.1";
}

parameters:{
    "device[platform]" = iOS;
    "device[udid]" = "D44DD5B1-A5B3-4E61-B761-A4DE8BB28F72";
    "push_token[client_identification_sequence]" = 8efc776c0ea913f3cd8785f68bb4d7f3bb3a5ffcfde76ed1beab1181d8aae8af;
    "push_token[environment]" = development;
}
2014-01-24 01:54:44.168 Chat[5670:7b1b] Performing async request: 

POST http://api.quickblox.com/session.xml

headers:{
    "QB-SDK" = "iOS 1.8";
    "Qb-Token" = 8564a56a8744464e61afdbb370c2d02cc3d940a6;
    "QuickBlox-REST-API-Version" = "0.1.1";
}

parameters:{
    "application_id" = 4354;
    "auth_key" = yYBXmUnyvpYPMe5;
    nonce = 524;
    signature = ce2521946486c0fb579a41f56e067661c059358b;
    timestamp = 1390499684;
}
2014-01-24 01:54:44.169 Chat[5670:7b1b] Performing async request: 

POST http://api.quickblox.com/session.xml

headers:{
    "QB-SDK" = "iOS 1.8";
    "Qb-Token" = 8564a56a8744464e61afdbb370c2d02cc3d940a6;
    "QuickBlox-REST-API-Version" = "0.1.1";
}

parameters:{
    "application_id" = 4354;
    "auth_key" = yYBXmUnyvpYPMe5;
    nonce = 484;
    signature = 9da8fc95d9de0819b5f12ebefdf421e569adf2f3;
    timestamp = 1390499684;
}
2014-01-24 01:54:44.417 Chat[5670:7b1b] Request finished, response:

headers:{
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = "max-age=0, private, must-revalidate";
    Connection = "keep-alive";
    "Content-Length" = 272;
    "Content-Type" = "application/xml; charset=utf-8";
    Date = "Thu, 23 Jan 2014 17:54:42 GMT";
    Etag = "\"36f956ca6271157cf23485a0efdd1770\"";
    "QB-Token-ExpirationDate" = "2014-01-23 19:54:42 UTC";
    "QuickBlox-REST-API-Version" = "0.1.1";
    Server = "nginx/1.0.15";
    Status = "201 Created";
    "X-Rack-Cache" = "invalidate, pass";
    "X-Request-Id" = 6d05ab80975f4f00042664f0cbcc1896;
    "X-Runtime" = "0.033340";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

body:

<?xml version="1.0" encoding="UTF-8"?>
<push-token>
  <client-identification-sequence>8efc776c0ea913f3cd8785f68bb4d7f3bb3a5ffcfde76ed1beab1181d8aae8af</client-identification-sequence>
  <environment>development</environment>
  <id type="integer">588770</id>
</push-token>
error:

2014-01-24 01:54:44.425 Chat[5670:7b1b] Performing async request: 

POST http://api.quickblox.com/subscriptions.xml

headers:{
    "QB-SDK" = "iOS 1.8";
    "Qb-Token" = 8564a56a8744464e61afdbb370c2d02cc3d940a6;
    "QuickBlox-REST-API-Version" = "0.1.1";
}

parameters:{
    "notification_channels" = apns;
}
2014-01-24 01:54:44.780 Chat[5670:310b] Request finished, response:

headers:{
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = "max-age=0, private, must-revalidate";
    Connection = "keep-alive";
    "Content-Length" = 524;
    "Content-Type" = "application/xml; charset=utf-8";
    Date = "Thu, 23 Jan 2014 17:54:42 GMT";
    Etag = "\"6fd90ffd8e3f5d10150f0acad6a0d46c\"";
    "QB-Token-ExpirationDate" = "2014-01-23 19:54:42 UTC";
    "QuickBlox-REST-API-Version" = "0.1.1";
    Server = "nginx/1.0.15";
    Status = "201 Created";
    "X-Rack-Cache" = "invalidate, pass";
    "X-Request-Id" = ce446bfab2d31c37e9e5ffc302603b8b;
    "X-Runtime" = "0.015738";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

body:

<?xml version="1.0" encoding="UTF-8"?>
<session>
  <_id>52e15762535c12b64600503e</_id>
  <application-id type="integer">4354</application-id>
  <created-at type="datetime">2014-01-23T17:54:42Z</created-at>
  <device-id type="integer">0</device-id>
  <nonce type="integer">524</nonce>
  <token>28ccd997f46ae70d9deec08d3e4a936881357ba7</token>
  <ts type="integer">1390499684</ts>
  <updated-at type="datetime">2014-01-23T17:54:42Z</updated-at>
  <user-id type="integer">0</user-id>
  <id type="integer">17423</id>
</session>
error:

2014-01-24 01:54:44.782 Chat[5670:60b] result is: <QBAAuthSessionCreationResult: 0x155825d0>
2014-01-24 01:54:44.788 Chat[5670:310b] Performing async request: 

POST http://api.quickblox.com/login.xml

headers:{
    "QB-SDK" = "iOS 1.8";
    "Qb-Token" = 28ccd997f46ae70d9deec08d3e4a936881357ba7;
    "QuickBlox-REST-API-Version" = "0.1.1";
}

parameters:{
    login = hehe;
    password = 12345678;
}
2014-01-24 01:54:44.800 Chat[5670:60b] result is: <QBAAuthSessionCreationResult: 0x15589e90>
2014-01-24 01:54:44.796 Chat[5670:7b1b] Request finished, response:

headers:{
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = "max-age=0, private, must-revalidate";
    Connection = "keep-alive";
    "Content-Length" = 524;
    "Content-Type" = "application/xml; charset=utf-8";
    Date = "Thu, 23 Jan 2014 17:54:42 GMT";
    Etag = "\"1f4ecc5c5bded2167a761a907f23f3e3\"";
    "QB-Token-ExpirationDate" = "2014-01-23 19:54:42 UTC";
    "QuickBlox-REST-API-Version" = "0.1.1";
    Server = "nginx/1.0.15";
    Status = "201 Created";
    "X-Rack-Cache" = "invalidate, pass";
    "X-Request-Id" = c6da0e923aa3fc6d530f08d298c7332b;
    "X-Runtime" = "0.014244";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

body:

<?xml version="1.0" encoding="UTF-8"?>
<session>
  <_id>52e15762535c12df80005377</_id>
  <application-id type="integer">4354</application-id>
  <created-at type="datetime">2014-01-23T17:54:42Z</created-at>
  <device-id type="integer">0</device-id>
  <nonce type="integer">484</nonce>
  <token>0744438380a2cbfadf8e859b98d8bab319dd4383</token>
  <ts type="integer">1390499684</ts>
  <updated-at type="datetime">2014-01-23T17:54:42Z</updated-at>
  <user-id type="integer">0</user-id>
  <id type="integer">27111</id>
</session>
error:

2014-01-24 01:54:44.804 Chat[5670:7b1b] Performing async request: 

POST http://api.quickblox.com/login.xml

headers:{
    "QB-SDK" = "iOS 1.8";
    "Qb-Token" = 0744438380a2cbfadf8e859b98d8bab319dd4383;
    "QuickBlox-REST-API-Version" = "0.1.1";
}

parameters:{
    login = hehe;
    password = 12345678;
}
2014-01-24 01:54:45.029 Chat[5670:380b] QBChat/didConnect
2014-01-24 01:54:45.059 Chat[5670:60b] Push notification subscribed
2014-01-24 01:54:45.058 Chat[5670:310b] Request finished, response:

headers:{
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = "max-age=0, private, must-revalidate";
    Connection = "keep-alive";
    "Content-Length" = 67;
    "Content-Type" = "application/xml; charset=utf-8";
    Date = "Thu, 23 Jan 2014 17:54:43 GMT";
    Etag = "\"4f31ca96db448bb738a3923db737871d\"";
    "QB-Token-ExpirationDate" = "2014-01-23 19:54:43 UTC";
    "QuickBlox-REST-API-Version" = "0.1.1";
    Server = "nginx/1.0.15";
    Status = "201 Created";
    "X-Rack-Cache" = "invalidate, pass";
    "X-Request-Id" = 9507e38031c78305d16b88a73e000557;
    "X-Runtime" = "0.024274";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

body:

<?xml version="1.0" encoding="UTF-8"?>
<nil-classes type="array"/>
error:

2014-01-24 01:54:45.430 Chat[5670:380b] Request finished, response:

headers:{
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = "no-cache";
    Connection = "keep-alive";
    "Content-Length" = 590;
    "Content-Type" = "application/xml; charset=utf-8";
    Date = "Thu, 23 Jan 2014 17:54:43 GMT";
    "QB-Token-ExpirationDate" = "2014-01-23 19:54:43 UTC";
    "QuickBlox-REST-API-Version" = "0.1.1";
    Server = "nginx/1.0.15";
    Status = "202 Accepted";
    "X-Rack-Cache" = "invalidate, pass";
    "X-Request-Id" = 4bfc06211bb0c0f97dd09f41ae92cff1;
    "X-Runtime" = "0.015643";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

body:

<?xml version="1.0" encoding="UTF-8"?>
<user>
  <blob-id type="integer" nil="true"/>
  <created-at type="datetime">2014-01-23T15:47:06Z</created-at>
  <email nil="true"/>
  <external-user-id type="integer" nil="true"/>
  <facebook-id nil="true"/>
  <full-name nil="true"/>
  <id type="integer">806773</id>
  <last-request-at type="datetime" nil="true"/>
  <login>hehe</login>
  <owner-id type="integer">5464</owner-id>
  <phone nil="true"/>
  <twitter-id nil="true"/>
  <updated-at type="datetime">2014-01-23T15:47:06Z</updated-at>
  <website nil="true"/>
  <user-tags nil="true"/>
</user>
error:

2014-01-24 01:54:45.436 Chat[5670:811b] -[QBChat loginWithUser:] -> Chat server endpoint: muc.chat.quickblox.com, User JID: 806773-4354@chat.quickblox.com
2014-01-24 01:54:45.442 Chat[5670:310b] Request finished, response:

headers:{
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = "no-cache";
    Connection = "keep-alive";
    "Content-Length" = 590;
    "Content-Type" = "application/xml; charset=utf-8";
    Date = "Thu, 23 Jan 2014 17:54:43 GMT";
    "QB-Token-ExpirationDate" = "2014-01-23 19:54:43 UTC";
    "QuickBlox-REST-API-Version" = "0.1.1";
    Server = "nginx/1.0.15";
    Status = "202 Accepted";
    "X-Rack-Cache" = "invalidate, pass";
    "X-Request-Id" = 99a2c81bc8c28fddbcd7e3a134243ca3;
    "X-Runtime" = "0.014854";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

body:

<?xml version="1.0" encoding="UTF-8"?>
<user>
  <blob-id type="integer" nil="true"/>
  <created-at type="datetime">2014-01-23T15:47:06Z</created-at>
  <email nil="true"/>
  <external-user-id type="integer" nil="true"/>
  <facebook-id nil="true"/>
  <full-name nil="true"/>
  <id type="integer">806773</id>
  <last-request-at type="datetime" nil="true"/>
  <login>hehe</login>
  <owner-id type="integer">5464</owner-id>
  <phone nil="true"/>
  <twitter-id nil="true"/>
  <updated-at type="datetime">2014-01-23T15:47:06Z</updated-at>
  <website nil="true"/>
  <user-tags nil="true"/>
</user>
error:

2014-01-24 01:54:45.448 Chat[5670:310b] -[QBChat loginWithUser:] -> Chat server endpoint: muc.chat.quickblox.com, User JID: 806773-4354@chat.quickblox.com
2014-01-24 01:54:45.464 Chat[5670:310b] Performing async request: 

POST http://api.quickblox.com/push_tokens.xml

headers:{
    "QB-SDK" = "iOS 1.8";
    "Qb-Token" = 0744438380a2cbfadf8e859b98d8bab319dd4383;
    "QuickBlox-REST-API-Version" = "0.1.1";
}

parameters:{
    "device[platform]" = iOS;
    "device[udid]" = "D44DD5B1-A5B3-4E61-B761-A4DE8BB28F72";
    "push_token[client_identification_sequence]" = 8efc776c0ea913f3cd8785f68bb4d7f3bb3a5ffcfde76ed1beab1181d8aae8af;
    "push_token[environment]" = development;
}
2014-01-24 01:54:46.107 Chat[5670:7b1b] Request finished, response:

headers:{
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = "max-age=0, private, must-revalidate";
    Connection = "keep-alive";
    "Content-Length" = 272;
    "Content-Type" = "application/xml; charset=utf-8";
    Date = "Thu, 23 Jan 2014 17:54:44 GMT";
    Etag = "\"36f956ca6271157cf23485a0efdd1770\"";
    "QB-Token-ExpirationDate" = "2014-01-23 19:54:44 UTC";
    "QuickBlox-REST-API-Version" = "0.1.1";
    Server = "nginx/1.0.15";
    Status = "201 Created";
    "X-Rack-Cache" = "invalidate, pass";
    "X-Request-Id" = a4319db211a2253aa7e98511d449e616;
    "X-Runtime" = "0.042459";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

body:

<?xml version="1.0" encoding="UTF-8"?>
<push-token>
  <client-identification-sequence>8efc776c0ea913f3cd8785f68bb4d7f3bb3a5ffcfde76ed1beab1181d8aae8af</client-identification-sequence>
  <environment>development</environment>
  <id type="integer">588770</id>
</push-token>
error:

2014-01-24 01:54:46.110 Chat[5670:7b1b] Performing async request: 

POST http://api.quickblox.com/subscriptions.xml

headers:{
    "QB-SDK" = "iOS 1.8";
    "Qb-Token" = 0744438380a2cbfadf8e859b98d8bab319dd4383;
    "QuickBlox-REST-API-Version" = "0.1.1";
}

parameters:{
    "notification_channels" = apns;
}
2014-01-24 01:54:46.266 Chat[5670:811b] -[QBChat xmppStreamDidAuthenticate:] -> user: 806773, supportsStartTLS: 1, isSecure: 0
2014-01-24 01:54:46.273 Chat[5670:310b] Performing async request: 

GET http://api.quickblox.com/data/Post.xml

headers:{
    "QB-SDK" = "iOS 1.8";
    "Qb-Token" = 0744438380a2cbfadf8e859b98d8bab319dd4383;
    "QuickBlox-REST-API-Version" = "0.1.1";
}

parameters:{
    "sort_asc" = datetime;
}
2014-01-24 01:54:46.276 Chat[5670:310b] Performing async request: 

GET http://api.quickblox.com/data/Contact.xml

headers:{
    "QB-SDK" = "iOS 1.8";
    "Qb-Token" = 0744438380a2cbfadf8e859b98d8bab319dd4383;
    "QuickBlox-REST-API-Version" = "0.1.1";
}

parameters:{
    "contact_id" = 806773;
}
2014-01-24 01:54:46.280 Chat[5670:310b] Performing async request: 

GET http://api.quickblox.com/data/Contact.xml

headers:{
    "QB-SDK" = "iOS 1.8";
    "Qb-Token" = 0744438380a2cbfadf8e859b98d8bab319dd4383;
    "QuickBlox-REST-API-Version" = "0.1.1";
}

parameters:{
    "user_identifier" = 806773;
}
2014-01-24 01:54:46.281 Chat[5670:310b] -[QBChat xmppStream:didSendIQ:] -> IQ: <iq type="get" id="5610067"><query xmlns="jabber:iq:roster"/></iq>
2014-01-24 01:54:46.282 Chat[5670:310b] -[QBChat xmppStream:didSendPresence:] -> Presence: <presence/>
2014-01-24 01:54:46.533 Chat[5670:811b] -[QBChat xmppStream:didReceiveIQ:] -> <iq xmlns="jabber:client" id="5610067" type="result" to="806773-4354@chat.quickblox.com/tigase-20326"><query xmlns="jabber:iq:roster"/></iq>
2014-01-24 01:54:46.615 Chat[5670:60b] objects: (null)
2014-01-24 01:54:46.614 Chat[5670:7b1b] Request finished, response:

headers:{
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = "max-age=0, private, must-revalidate";
    Connection = "keep-alive";
    "Content-Length" = 60;
    "Content-Type" = "application/xml; charset=utf-8";
    Date = "Thu, 23 Jan 2014 17:54:44 GMT";
    Etag = "\"81779d89d928c6e830957d0cee5976fa\"";
    "QB-Token-ExpirationDate" = "2014-01-23 19:54:44 UTC";
    "QuickBlox-REST-API-Version" = "0.1.1";
    Server = "nginx/1.0.15";
    Status = "304 Not Modified";
    "X-Rack-Cache" = miss;
    "X-Request-Id" = 76bb535a5aa49e342dbf67fc1ae66950;
    "X-Runtime" = "0.019699";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

body:

<?xml version="1.0" encoding="UTF-8"?>
<data type="array"/>
error:

2014-01-24 01:54:46.620 Chat[5670:60b] objects: (null)
2014-01-24 01:54:46.622 Chat[5670:310b] Request finished, response:

headers:{
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = "max-age=0, private, must-revalidate";
    Connection = "keep-alive";
    "Content-Length" = 60;
    "Content-Type" = "application/xml; charset=utf-8";
    Date = "Thu, 23 Jan 2014 17:54:44 GMT";
    Etag = "\"81779d89d928c6e830957d0cee5976fa\"";
    "QB-Token-ExpirationDate" = "2014-01-23 19:54:44 UTC";
    "QuickBlox-REST-API-Version" = "0.1.1";
    Server = "nginx/1.0.15";
    Status = "304 Not Modified";
    "X-Rack-Cache" = miss;
    "X-Request-Id" = ea19e51670b676c6b618662924052c99;
    "X-Runtime" = "0.019819";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

body:

<?xml version="1.0" encoding="UTF-8"?>
<data type="array"/>
error:

2014-01-24 01:54:46.703 Chat[5670:60b] Push notification subscribed
2014-01-24 01:54:46.703 Chat[5670:7b1b] Request finished, response:

headers:{
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = "max-age=0, private, must-revalidate";
    Connection = "keep-alive";
    "Content-Length" = 67;
    "Content-Type" = "application/xml; charset=utf-8";
    Date = "Thu, 23 Jan 2014 17:54:44 GMT";
    Etag = "\"4f31ca96db448bb738a3923db737871d\"";
    "QB-Token-ExpirationDate" = "2014-01-23 19:54:44 UTC";
    "QuickBlox-REST-API-Version" = "0.1.1";
    Server = "nginx/1.0.15";
    Status = "201 Created";
    "X-Rack-Cache" = "invalidate, pass";
    "X-Request-Id" = e437212cb4bf3ecfc2170f85f9dbcbfb;
    "X-Runtime" = "0.022193";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

body:

<?xml version="1.0" encoding="UTF-8"?>
<nil-classes type="array"/>
error:

2014-01-24 01:54:46.929 Chat[5670:310b] Request finished, response:

headers:{
    "Access-Control-Allow-Origin" = "*";
    "Cache-Control" = "max-age=0, private, must-revalidate";
    Connection = "keep-alive";
    "Content-Length" = 651;
    "Content-Type" = "application/xml; charset=utf-8";
    Date = "Thu, 23 Jan 2014 17:54:44 GMT";
    Etag = "\"bfdd8b18a9743a7d8aa5315262ec961d\"";
    "QB-Token-ExpirationDate" = "2014-01-23 19:54:44 UTC";
    "QuickBlox-REST-API-Version" = "0.1.1";
    Server = "nginx/1.0.15";
    Status = "304 Not Modified";
    "X-Rack-Cache" = miss;
    "X-Request-Id" = 14ffdcfa6108ebb2614dd90721299f23;
    "X-Runtime" = "0.020542";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

body:

<?xml version="1.0" encoding="UTF-8"?>
<data type="array" class_name='Post' skip='0' limit='100'>
  <Post>
    <_id>52e13bd8535c1278a4004f83</_id>
    <_parent_id nil="true"/>
    <created-at type="integer">1390492632</created-at>
    <datetime type="integer">20140123235708343</datetime>
    <info>entity=post type=text post_identifier=20140123235708343a806749 datetime=20140123235708343 poster_id=806749 blob_id= text=post no</info>
    <post_identifier>20140123235708343a806749</post_identifier>
    <poster_id>806749</poster_id>
    <updated-at type="integer">1390492632</updated-at>
    <user-id type="integer">806749</user-id>
  </Post>
</data>
error:

2014-01-24 01:54:46.931 Chat[5670:60b] objects: (
    "
    className:Post                      
    createdAt:2014-01-23 15:57:12 +0000                      
    updatedAt:2014-01-23 15:57:12 +0000                      
    ID:52e13bd8535c1278a4004f83                      
    parentID:(null)                      
    userID:806749                      
    fields:{\n    datetime = 20140123235708343;\n    info = \"entity=post type=text post_identifier=20140123235708343a806749 datetime=20140123235708343 poster_id=806749 blob_id= text=post no\";\n    \"post_identifier\" = 20140123235708343a806749;\n    \"poster_id\" = 806749;\n}                      
    permissions:(null)"
)
2014-01-24 01:54:47.317 Chat[5670:811b] -[QBChat xmppStream:didSendPresence:] -> Presence: <presence/>

UPDATE 2:

When I enter background, then enter foreground, I will check if chat is logged in. using this condition:

[QBChat instance].isLoggedIn

(1)If it's logged in, i fetch several tables

(2)if not, I create a session and login again

My Guess: Is it possible that after entering the background for a while, the session has been destroyed, while [QBChat instance].isLoggedIn still returns YES? If this is the case, then how can I test whether I can safely fetch tables?

The screen always turns black within 3 seconds after entering the foreground. I tried both iOS 6/7

Note: The screen goes black, but the app does not crash. because sendPresence timer still ticking every 15 seconds:

-[QBChat xmppStream:didSendPresence:] -> Presence: <presence/>

UPDATE 3: I just catch a crash

enter image description here

enter image description here

UPDATE 4: Device Log (Xcode organizer)

Date/Time:           2014-01-23 23:45:40.090 +0800
OS Version:          iOS 7.0.2 (11A501)
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x0000000027c1fff8
Triggered by Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib                 0x39411751 lookUpImpOrForward + 5
1   libobjc.A.dylib                 0x3941172b lookUpImpOrNil + 23
2   libobjc.A.dylib                 0x3940acb3 class_respondsToSelector + 31
3   libobjc.A.dylib                 0x3941a059 -[NSObject respondsToSelector:] + 29
4   Chat                            0x00141491 -[QBApplicationRedelegate applicationWillResignActive:] (QBApplicationRedelegate.m:111)
5   Chat                            0x001414cd -[QBApplicationRedelegate applicationWillResignActive:] (QBApplicationRedelegate.m:112)
6   Chat                            0x001414cd -[QBApplicationRedelegate applicationWillResignActive:] (QBApplicationRedelegate.m:112)
7   Chat                            0x001414cd -[QBApplicationRedelegate applicationWillResignActive:] (QBApplicationRedelegate.m:112)
8   Chat                            0x001414cd -[QBApplicationRedelegate applicationWillResignActive:] (QBApplicationRedelegate.m:112)
Was it helpful?

Solution

I solved the question by registering push notification in ChatDidLogin instead of user did login delegate method.

the problem is that login use will return success even use has already logged in, which will register push notification twice. However, chat will fail if already logged in.

My app constantly checks whether the server is logged in by

+ (BOOL)isServerLoggedIn {
    return [QBChat instance].isLoggedIn;
}

if not logged in, I create session with delegate again, which will then log user in upon success, and then log chat in upon success.

Edit: there is a problem with this design:

What if [QBChat instance].isLoggedIn is true but QBUser is not logged in?? How to check whether QBUser is logged in?

OTHER TIPS

You can be separately logged in to Chat and to REST services.

To check if QBUser is logged in - just create a separate variable and set it to YES in delegate:

// QuickBlox queries delegate
- (void)completedWithResult:(Result *)result{

    if(result.success){

        // User Login
        if([result isKindOfClass:QBUUserLogInResult.class]){

            self.userLoggedIn = YES;
        }
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top