Reputation: 3885
I'd like my app to have save a username and password for each user and login with it, unless it is changed to another user.
I was asking myself how I can send the Push notifications to the relevant device ?
What kind of data do I need to send alongside the username and password each time a username/password have changed or newly entered ?
Upvotes: 1
Views: 531
Reputation: 12852
Implement this method in your AppDelegate, the value of "str" represents the unique string for the device. Use this in addition to username and password to uniquely identify a user on a specific device.
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSString *str = [NSString
stringWithFormat:@"Device Token=%@",deviceToken];
NSLog(str);
}
A prerequisite for this is to call this line of code somewhere in your application, usually from applicationDidFinishLaunching
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound)];
This is a very good end to end reference on programming iOS Push Notifications (scroll way down past the configuration information to find the programming techniques): http://mobiforge.com/developing/story/programming-apple-push-notification-services
Upvotes: 4