Note that there are some explanatory texts on larger screens.

plurals
  1. POSwiping push notification away should open related news
    primarykey
    data
    text
    <p>I'm new to iPhone development, but managed to receive push notifications in my iOS App. However, when I swipe away the incoming push notification, it just opens the app, but not the related post to the notification.</p> <p>This is my code:</p> <pre><code>- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{ NSLog(@"Eine Nachricht ist angekommen, während die App aktiv ist"); NSString* alert = [[userInfo objectForKey:@"aps"] objectForKey:@"id"]; NSLog(@"Nachricht: %@", alert); //This is to inform about new messages when the app is active //UIApplicationState state = [[UIApplication sharedApplication] applicationState]; //if (state == UIApplicationStateActive) { // UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Neuer Artikel" message:@"Nachricht" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; // [alertView show]; // } } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { NSLog(@"Device Token=%@", deviceToken); NSUInteger theCount = [deviceToken length]; NSMutableString *theString = [NSMutableString stringWithCapacity:2 * theCount]; unsigned char const *theBytes = [deviceToken bytes]; for(NSUInteger i = 0; i &lt; theCount; ++i) { [theString appendFormat:@"%2.2x", theBytes[i]]; } NSString* url = [NSString stringWithFormat:@"HERE_IS_MY_REGISTERING_URL",theString,theString]; NSLog(@"APNS URL : %@",url); NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:[url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]; [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue currentQueue] completionHandler:^(NSURLResponse *urlResponse, NSData *data, NSError *error) { if (error) { NSLog(@"Error: %@", error); } }]; } - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{ NSLog(@"Error bei der Registrierung"); - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window.frame = [[UIScreen mainScreen] bounds]; [self setApplicationDefaults]; [[UIApplication sharedApplication] setStatusBarHidden:NO]; //This is the start of the push notification settings [self.window makeKeyAndVisible]; </code></pre> <p>Now, I have no Idea what to put where, to open a related post to a push notification... </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload