简体   繁体   中英

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. I am new to parse and ios so any help would be much appreciated.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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