link for server I used http://stefan.hafeneger.name/download/PushMeBabySource.zip
I used PushMeBaby server and push app with my certificate and provisioning profile,it gave notification in form of alert on device and print the statement on console written in method only when first time I ran the application,but while running the application for next multiple times for testing it returns only device token,the following method doesnt execute at all.Please help me solving this problem.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
for (id key in userInfo) {
NSLog(@”key: %@, value: %@”, key, [userInfo objectForKey:key]);
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@”alert” message:key delegate:self cancelButtonTitle:@”ok” otherButtonTitles:nil];
[alert show];
/*if(key)
{
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@”alert” message:@”this is in application” delegate:self canc开发者_开发知识库elButtonTitle:@”ok” otherButtonTitles:nil];
[alert show];
}*/
}
}
Please help me as soon as possible
You need to get the token every time you start the application. Sometimes it changes.
The delegate (didReceiveRemoteNotification) gets invoked when a running application receives a remote notification.
If you implement application:didFinishLaunchingWithOptions: to handle an incoming push notification that causes the launch of the application, this method (didReceiveRemoteNotification) is not invoked for that push notification.
For details about push notifications see:
developer apple-ApplePushService
精彩评论