Examine iOS Push Notification Payload -
I can figure out how to determine the payload of a push notification in that which is the scene when a Opening the app opens the app from the notification, for example, a notification says that if "X: test" when notification is used, x opens and notification is called.
EDIT: I think I should make clear the part I'm not sure about
I have done this in FineishLaunchingWithOptions:
UILocalNotification * Notification = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey]. If (notification) {// check payload then proper view controller load}
How do I check the payload for some text to determine the appropriate view controller for loading the command?
Here is my code from a previous project, the notification appears in the device like this "Costas: The friend's "
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert]] ;. NSDictionary * RemoteNotify = [Launch Option ObjectForchy: UI application launch launch Remonant Notification]; If (RemoteNotif) {NSString * name = [[NSString alloc] init]; NSString * message = [[NSString alloc] init]; // 'wants to add you as a friend.' NSSTING * AlertValue = [[RemoteNotif standards: @ "APS"] Valufei: @ "Alert"]; NSMutableArray * Parts = [NSMutableArray ArraysErray: [Warning Value ComponentsBettering: @ ":"]]; Name = [parts objects at indexx: 0]; [Remove parts Object Index: 0]; Message = [part components-judged biostring: @ ":"]; If you want to add ([Message isEqualToString: @ ": as a friend"]] {UITabBarController * tabController = (UITabBarController *) self.window.rootViewController; // tabController.delegate = self; TabController.selectedIndex = 1; } And {UITabBarController * tabController = (UITabBarController *) self.window.rootViewController; // tabController.delegate = self; TabController.selectedIndex = 2; [Self addMessageFromRemoteNotification: Remote Notif updateUI: no]; }
Comments
Post a Comment