Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting random end user from QuickBlox
    text
    copied!<p>I'm developing a social app. For current user, I need to randomly show other users of the app.</p> <p>I first want to use this code to get the number of users:</p> <pre><code>PagedRequest *request = [PagedRequest new]; request.perPage = 1; request.page = 1; [QBUsers usersWithPagedRequest:request delegate:self.proxy]; </code></pre> <p>I noticed that this is the XML returned:</p> <pre><code>&lt;users type="array" current_page="1" per_page="1" total_entries="13"&gt; &lt;user&gt; &lt;blob-id type="integer" nil="true"/&gt; &lt;created-at type="datetime"&gt;2013-07-24T06:16:13Z&lt;/created-at&gt; &lt;email&gt;xxxxxx@xx.com&lt;/email&gt; &lt;external-user-id type="integer" nil="true"/&gt; &lt;facebook-id nil="true"/&gt; &lt;full-name&gt;XXX xxx&lt;/full-name&gt; &lt;id type="integer"&gt;236286&lt;/id&gt; &lt;last-request-at type="datetime"&gt;2013-11-15T06:27:09Z&lt;/last-request-at&gt; &lt;login&gt;t2wu&lt;/login&gt; &lt;owner-id type="integer"&gt;4282&lt;/owner-id&gt; &lt;phone nil="true"/&gt; &lt;twitter-id nil="true"/&gt; &lt;updated-at type="datetime"&gt;2013-11-15T06:27:09Z&lt;/updated-at&gt; &lt;website nil="true"/&gt; &lt;user-tags nil="true"/&gt; &lt;/user&gt; &lt;/users&gt; </code></pre> <p>My intention is to get the 13 from the "total_entries=13", so I know that the total number of users, then make a request like this again:</p> <pre><code>PagedRequest *request = [PagedRequest new]; request.perPage = 1; request.page = [self randomAmong: 13]; [QBUsers usersWithPagedRequest:request delegate:self.proxy]; </code></pre> <p>where <code>[self randomAmong: 13]</code> just pick one number out of 1 and 13, then grab the user's profile picture and show it to the current user.</p> <p>Three questions:</p> <ol> <li><p>Although I can see the number 13 in the XML in the console output, I have no idea how to get that number. </p></li> <li><p>I only want to rotate through my mobile application users, not my developer's account (the account user). QuickBlox allows multiple applications associated with one QuickBlox account user; however, all users seems to be lumped together. Although I could make sure that I only have one application inside this account, I still need to be able to exclude myself from it. </p></li> <li><p>This is a relatively minor question. Although the above attempt to get the current number of users is not an attempt to log in, the delegate method <code>-(void)completedWithResult:(Result*)result</code> has result as a class of <code>QBUUserLogInResult</code>. I don't understand why it is, why isn't it <code>QBUUserPagedResult</code> or <code>QBUUserResult</code> which seems to make more sense?</p></li> </ol> <p>Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload