2015-09-01 4 views
0

Я пытаюсь использовать уведомление о синтаксическом разборе в своем приложении iOS, последовал шаг за шагом руководство на веб-сайте parse.com, но он все еще не работает, вот мой делегат приложения .mУведомления о парсе не работают на iOS

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 



    [Parse enableLocalDatastore]; 

    // Initialize Parse. 
    [Parse setApplicationId:@"XXXXXXXXXXXX" 
        clientKey:@"XXXXXXXXXXX"]; 




    // [Optional] Track statistics around application opens. 
    [PFAnalytics trackAppOpenedWithLaunchOptions:launchOptions]; 


    NSLog(@"START"); 
    // Register for Push Notitications 
    UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | 
                UIUserNotificationTypeBadge | 
                UIUserNotificationTypeSound); 

    if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) 
    { 
     // iOS 8 Notifications 
     [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]]; 

     [application registerForRemoteNotifications]; 
    } 
    else 
    { 
     // iOS < 8 Notifications 
     [application registerForRemoteNotificationTypes: 
     (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)]; 
    } 

     [self grabStoryboard]; 
    [FBLoginView class]; 
    [FBProfilePictureView class]; 


    return YES; 
} 


- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 
    // Store the deviceToken in the current installation and save it to Parse. 
    PFInstallation *currentInstallation = [PFInstallation currentInstallation]; 
    [currentInstallation setDeviceTokenFromData:deviceToken]; 
    [currentInstallation saveInBackground]; 
} 

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { 
    if (error.code == 3010) { 
     NSLog(@"Push notifications are not supported in the iOS Simulator."); 
    } else { 
     // show some alert or otherwise handle the failure to register. 
     NSLog(@"application:didFailToRegisterForRemoteNotificationsWithError: %@", error); 
    } 
} 

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { 
    [PFPush handlePush:userInfo]; 
} 

на parse.com я вижу, что я имею 1 зарегистрированное устройство, но когда я нажимаю на «отправить толчок» толчки посланные равны 0

ответ

0

Вы должны проверьте настройки App грамматического разбора. Перейдите к push-уведомлениям и убедитесь, что вы загрузили правильные сертификаты (Apple Push Certificates). Это должно решить вашу проблему.

+0

да, я загрузил его с тем же идентификатором расслоении моего приложения –

+0

, но все еще не работает –

0

добавьте это в регистрацию для удаленных уведомлений.

[currentInstallation setObject:[PFUser currentUser].objectId forKey:@"owner"]; 

и где вы посылаете ваш толчок добавить

PFQuery *pushQuery = [PFInstallation query]; 
[pushQuery whereKey:@"owner" containedIn:self.recipients]; 

также, если это не работает, покажите мне ваш метод, когда вы посылаете толчок

Смежные вопросы