Search code examples
iosobjective-cpubnub

Get related subscribed channel(s) in didReceiveStatus in PubNub for iOS objective C


When didReceiveStatus is called after subscribing to a channel, We are not able to retrieve the channel(s) that was just subscribed.

PNSubscribeStatus.data.subscribedChannel or PNSubscribeStatus.data.actualChannel are always null and PNSubscribeStatus.subscribedChannels gives all currently subscribed channels and not the ones that triggered the didReceiveStatus callback.

What are we doing wrong here ?


Solution

  • In SDK 4.0, didReceiveStatus returns a PNStatus, which according to the class documentation doesn't contain that extra information unless there's an error condition. For our application, we use that handler to monitor connection status to the PubNub server.