iphone - 解析 iPhone 中的推送通知

标签 iphone ios xcode cocos2d-iphone parse-platform

综合parse 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

这是一个similar post对我没有帮助......尝试了所有建议的解决方案。出了什么问题..已经在 parse.com 中上传了开发推送 SSL。帮我找到解决方案。

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

最佳答案

您好,您尝试过这个解析分步教程吗? https://www.parse.com/tutorials/ios-push-notifications

按照教程进行操作,如果您获得堆栈,您可以在此处发帖寻求帮助。

关于iphone - 解析 iPhone 中的推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15781679/

相关文章:

ios - 核心数据实体的初始化方法不可用

ios - 调试时在 Xcode 中查看对象/属性状态

iphone - 在 UIDatePicker 中仅显示小时

ios - 在多个文件中重复使用相同的 UIColor

ios - 如何在 iOS 项目中包含 C 库 (VLFeat 0.9.21)?

ios - 无法第二次调用 GCKRemoteMediaClientListener

javascript - 如何在 iPhone 上聚焦 HTML 文本字段(导致键盘出现)?

单击主页按钮关闭应用程序而不是暂停的iPhone应用程序

ios - TableView 单元格到另一个 View Controller

cocoa - 构建和分析工具 Cocoa Xcode