Skip to content

Instantly share code, notes, and snippets.

@ChrisRisner
Last active December 10, 2015 07:09
Show Gist options
  • Save ChrisRisner/4399249 to your computer and use it in GitHub Desktop.
Save ChrisRisner/4399249 to your computer and use it in GitHub Desktop.
iOS Day 27
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
return YES;
}
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
NSLog(@"Push received: %@", userInfo);
}
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
NSLog(@"Push received: %@", userInfo);
ViewController *vc = (ViewController *)self.window.rootViewController;
vc.lblInfo.text = @"Push received";
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSLog(@"APN device token: %@", deviceToken);
}
2012-12-28 09:17:21.436 DayTwentySix[516:907] Push received: {
aps = {
alert = "Toast: Message";
};
}
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *lblInfo;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment