2

在 iOS 项目中集成解析推送通知。不工作。

这是我的代码:

#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

这是一篇类似的帖子,对我没有帮助..尝试了所有建议的解决方案。怎么了..已经在 parse.com 中上传了开发推送 SSL。帮助我获得解决方案。

现在来自 parse.com 的测试推送消息未在设备中传递。

4

2 回答 2

2

嗨,你有没有尝试这个 Parse 一步一步教程 https://www.parse.com/tutorials/ios-push-notifications

按照教程,如果你得到堆栈,你可以在这里发帖寻求帮助。

于 2013-04-03T10:00:22.367 回答
0

好的 终于解决了这个问题。

• 我们需要在app id 部分配置push SLL 后创建新的配置文件。然后我们需要使用新的配置文件。

这解决了我的问题,现在从 Parse 获得测试推送消息。

于 2013-04-11T06:23:01.883 回答