2013-04-03 134 views
1

在iOS項目中集成了parse推送通知。不工作。iPhone中的解析推送通知

這裏是我的代碼:

#ifdef ENABLE_PARSE_PUSH 
#import "Parse/Parse.h" 
#endif 

//in appDelegate didFinishLaunchingWithOptions 

#ifdef ENABLE_PARSE_PUSH 

    // Obtain the installation object for the current device 

    [Parse setApplicationId:PARSE_APP_ID clientKey:PARSE_APP_SIGNATURE]; 

    PFInstallation *myInstallation = [PFInstallation currentInstallation]; 

    // Save some data 
    [myInstallation setObject:@"YES" forKey:@"scoreUpdates"]; 

    // Save or Create installation object 
    [myInstallation saveInBackground]; 

    [application registerForRemoteNotificationTypes: 
    UIRemoteNotificationTypeBadge | 
    UIRemoteNotificationTypeAlert | 
    UIRemoteNotificationTypeSound]; 
#endif 



#ifdef ENABLE_PARSE_PUSH 
- (void)application:(UIApplication *)application 
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)newDeviceToken 
{ 
    [PFPush storeDeviceToken:newDeviceToken]; // Send parse the device token 
    // Subscribe this user to the broadcast channel, "" 
    [PFPush subscribeToChannelInBackground:@"" block:^(BOOL succeeded, NSError *error) { 
     if (succeeded) 
     { 
      //#ifdef DEBUG 
      //NSLog(@"Successfully subscribed to the broadcast channel."); 
      //#endif 
     } 
     else 
     { 
      //#ifdef DEBUG 
      //NSLog(@"Failed to subscribe to the broadcast channel."); 
      //#endif 
     } 
    }]; 
} 

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

#endif 

這裏是一個similar post沒有幫助的me..tried所有建議的解決方案。什麼是錯誤的......已經上傳的開發在parse.com中推送SSL。幫助我獲得解決方案。

現在來自parse.com的測試推送消息未在設備中傳遞。

+0

沒有問題描述的解決方案。 「不工作」可能意味着任何事情。 – LearnCocos2D

+0

當我從parse.com發送推送消息,然後它不傳遞給任何設備... – iPhoneProcessor

回答

0

好的最後解決了這個問題。

•我們需要在配置應用程序ID部分的推送SLL後創建新的配置文件。然後我們需要使用新的配置文件。

這解決了我的問題,現在從Parse獲取測試推送消息。

2

嗨你有沒有嘗試教程一步 https://www.parse.com/tutorials/ios-push-notifications

此解析步驟,按照教程,如果你得到疊加,你可以張貼在這裏尋求幫助。

+0

完全相同的鏈接,我遵循整合...現在雙重檢查...沒有使用 – iPhoneProcessor

+0

幾件事情來檢查,是您的應用程序保存數據庫上的安裝密鑰?你需要找到問題,請嘗試NSlog獲得一些反饋.. – HernandoZ

+0

導出SSL證書時沒有使用密鑰...爲我的其他項目之一工作..同樣的代碼不工作在這...奇怪 – iPhoneProcessor