添加解析推送通知时出错

时间:2014-09-12 16:49:42

标签: ios xcode parse-platform

如下图所示,我收到以下错误消息。该项目是一个现有项目,所以我按照解析教程。我似乎得到这个错误,解析网站识别0设备。我是新来解析和ios所以任何帮助将不胜感激。

https://imgur.com/ivPAsAj

2 个答案:

答案 0 :(得分:0)

您错过了}方法

下的结束括号DidFinishLaunchingWithOptions

答案 1 :(得分:0)

您正在以非常错误的方式将函数放入其他函数中。它应该是这样的:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [Parse setApplicationId:@"bla" clientKey:@"bla"];

    [application registerForRemoteNotificationTypes:
                 UIRemoteNotificationTypeBadge |
                 UIRemoteNotificationTypeAlert |
                 UIRemoteNotificationTypeSound];
    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 didReceiveRemoteNotification:(NSDictionary *)userInfo
{
    [PFPush handlePush:userInfo];
}

您肯定需要阅读一些代码基础知识。