What are the differences between iOS notifications, local notifications, and push notifications? APNS mechanism ., Iosapns
Local/push notifications are designed for different needs.
Local notifications are local for iPhone, iPad, or iPod.
Push notifications-from outside the device. They come from remote servers-also known as remote notifications-that are pushed to applications on the device (using APNs) and can view messages or download data at the same time.
APNS: Apple Push Notification Service"
Mobile phone -- (uuid, bundleid) apns
Apns-token-mobile phone
Mobile phone -- upload token to server -- server record token
Server -- send token to -- apns
Apns-push to Mobile Phone Based on token
Register to receive remote notifications
-(BOOL) application :( UIApplication *) application metadata :( NSDictionary *) launchOptions {// register remote notification UIRemoteNotificationType = custom | UIRemoteNotificationTypeBadge | uiremotenotiftypetypesound; [application metadata: type]; return YES ;}
Receive deviceToken
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{ NSLog(@"%@", deviceToken);}
Send deviceToken to your server
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{ NSLog(@"%@", deviceToken);}