My question is same of User list for pubnub-chat objective c but it seem has no helpful answers.
- I registed client with Pub & Sub key with Presence = YES
- I subsrcibed to "My channel" and could send msg to it
- I used debug console in PubNub admin to create 2 others clients, I could send msg together
- I enable Presence in Admin (http://prntscr.com/iyv7b1)
- I get list user that subscribe "My channel" by function:
[client hereNowForChannel:@"My channel" withVerbosity:PNHereNowState completion:^(PNPresenceChannelHereNowResult *result, PNErrorStatus *status)
{
if (!status) {
}
else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Couldn't get list of user." delegate:nil cancelButtonTitle:@"Close" otherButtonTitles:nil];
[alert show];
}
}];
I tried to change
PNHereNowState -> PNHereNowUUID -> PNHereNowOccupancy
But my result is always NIL.
Anybode help me, pls
I found the answer for my question, hope it helps for who need
[client hereNowForChannel:client.globalChannel withCompletion:^(PNPresenceChannelHereNowResult *result, PNErrorStatus *status)
{
if (!status) {
PNPresenceChannelHereNowData *data = result.data;
if (data) {
NSArray *list = [data uuids];
}
}
else {
}
}];
The property data, it won't be set value if has no access to it yet, so I did call PNPresenceChannelHereNowData *data = result.data; and it had data.