简体   繁体   English

添加解析推送通知时出错

[英]Error when adding parse push notifications

As you can see in the image below I get the following error. 如您在下图中所看到的,我收到以下错误。 The project is an existing project so I followed the tutorial on parse. 该项目是现有项目,因此我遵循了解析教程。 I seem to get this error and the parse website recognises 0 devices. 我似乎收到此错误,解析网站识别出0台设备。 I am new to parse and ios so any help would be much appreciated. 我是解析和ios的新手,所以将不胜感激。

https://imgur.com/ivPAsAj https://imgur.com/ivPAsAj

您在DidFinishLaunchingWithOptions方法下缺少了DidFinishLaunchingWithOptions括号}

You are placing functions into other functions in a very wrong way. 您正在以非常错误的方式将函数放置到其他函数中。 It should look like this: 它看起来应该像这样:

- (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];
}

You definitely need to read some code fundamentals. 您肯定需要阅读一些代码基础知识。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM