Отправить уведомление - PullRequest
       18

Отправить уведомление

4 голосов
/ 02 сентября 2011

ссылка на сервер, который я использовал http://stefan.hafeneger.name/download/PushMeBabySource.zip

Я использовал сервер PushMeBaby и приложение push с моим сертификатом и профилем инициализации, он выдавал уведомление в виде оповещения на устройстве и печатал оператор на консоли, написанный в методе, только при первом запуске приложения, но при запуске приложения для Следующие несколько раз для тестирования он возвращает только маркер устройства, следующий метод не выполняется вообще. Пожалуйста, помогите мне решить эту проблему.

- (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 cancelButtonTitle:@”ok” otherButtonTitles:nil];
    [alert show];
    }*/

    }
}

Пожалуйста, помогите мне как можно скорее

Ответы [ 2 ]

3 голосов
/ 02 сентября 2011

Токен необходимо получать при каждом запуске приложения.Иногда это меняется.

2 голосов
/ 02 сентября 2011
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.

Подробнее о push-уведомлениях см .:
developer apple-ApplePushService

...