IOS push message message - action after clicking the VIEW button

I have some problems with push notifications. I can send them to my registered devices. Everything is working fine.

My questions: After clicking the VIEW button, the application starts. At the moment, without any content.

How can I add content here? This content should depend on the push message being sent.

For example: My Push Notification about NEWS number 1 - then after clicking VIEW I should get additional information about NEWS number 1

etc.

It should also be possible to read all previous NEWS received in the application in the list when returning from NEWS number 1.

Do you understand what I mean?

I have no real idea ... It would be nice if you could show me the code related to the example.

Thank.

+5
3

, :

// will be called if the app was not active
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [self applicationDidFinishLaunching:application];

    if (launchOptions != nil)
    {
        NSDictionary* dictionary = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
        if (dictionary != nil)
        {
            // get the necessary information out of the dictionary 
            // (the data you sent with your push message)
            // and load your data
        }
    }
    return YES;
}

// will be called when in foreground
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {    
    // get the necessary information out of the dictionary 
    // (the data you sent with your push message)
    // and load your data
  }

APNS: http://www.raywenderlich.com/3525/apple-push-notification-services-tutorial-part-2

+9

, , application:didFinishLaunchingWithOptions:. (, push ..) .

, application:didReceiveRemoteNotification: , . , - , .

+1

an error occurs while generating the UUID of the notification. Instead of using __bridge, you should use __bridge_transfer or CFBridgingRelease; otherwise CFStringRef will never be released.

0
source

All Articles