Envin
Envin

Reputation: 1523

Enabling Push Notifications for a Parse iOS application -- having trouble setting it up

I have followed the Parse guide on how to set this up twice now, but it isn't working.

  1. In my Apple Developer Account, under Identifiers, I modified the App ID to use "Push Notifications".
  2. I followed the instructions and created a SSL certificate and installed it to my Macbook keychain
  3. I exported the SSL certificate from my macbook keychain (with no password) and imported it into the "Push Notification" settings page in Parse.
  4. I added this code to the appdelegate.m, at didFinishLaunchingWithOptions method after my Parse registration key.
[application registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|
                                                UIRemoteNotificationTypeAlert|
                                                UIRemoteNotificationTypeSound];
 - (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];
}

I simply cannot figure out what is not working.

My provisioning profiles have worked fine, I've been working on the app for a few months now (local development and TestFlight testing).

I'm not sure if maybe the Parse tutorial is out of date? Maybe it is done differently now? Can anyone provide any insight?

Very much appreciated!

Upvotes: 1

Views: 373

Answers (2)

Envin
Envin

Reputation: 1523

I had to run on a real device instead of the iOS simulator.

Upvotes: 0

Rafał Sroka
Rafał Sroka

Reputation: 40038

You have to set app ID and client key before you set the device token:

[Parse setApplicationId:PARSE_APP_ID
              clientKey:PARSE_CLIENT_KEY];

Upvotes: 2

Related Questions