If the storage and history feature is enabled, you can use this snippet to retrieve previously published messages from storage.
Click to copy the blue snippets and then paste them into your code.#import "AppDelegate.h" #import <PubNub/PubNub.h> #import <PubNubBridge/PubNub+FAB.h> @interface AppDelegate () @property (nonatomic, strong) PubNub *client; @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.client = [PubNub client]; [self.client historyForChannel:@"lobby" withCompletion:^(PNHistoryResult *result, PNErrorStatus *status) { // Check whether request successfully completed or not. if (!status.isError) { // Handle downloaded history using: // result.data.start - oldest message time stamp in response // result.data.end - newest message time stamp in response // result.data.messages - list of messages } // Request processing failed. else { // Handle message history download error. Check 'category' property to find out possible // issue because of which request did fail. // // Request can be resent using: [status retry]; } }]; return YES; } @end