I have made my own push notification server for my iPhone app. I am sending different push notifications to client devices. Now with one special of the notification, I want to call a specific function in appDelegate or anywhere.
How can I implement this?
you cannot specify a function to call DIRECTLY
when the app is launched,
-(BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptionsis called and passed the note in the options underUIApplicationLaunchOptionsRemoteNotificationKeywhen the app is running, you have
application:didReceiveRemoteNotification:you could pass the NAME of a method to call with the notification! so:
the server side JSON would contain the methodName key:
as seen here we can Include all we like APNS JSON PAYLOAD – more arguments