Start a new topic

Push notification is not received on iOS device

Hello,


I implemented iOS push notifications according to the doc. When testing it from the BL test  tool, it says that notification sent with status "accepted 202". But there is nothing on the device. The .p12 file was successfully uploaded before. 


Also, when device is connected to Xcode, the following error is reported: "registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later."

This error is caused by this statement in the didFinishLaunchingWithOptions

[KCSPush registerForPush]; 


Here are other client side code relating to Push:


- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

{

    [[KCSPush sharedPush] application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken completionBlock:^(BOOL success, NSError *error) {

 

        if (error != nil)

        {

            NSLog(@"error registering push %@", [error localizedDescription]);

        }

 

        //if there is an error, try again later

    }];

    // Additional registration goes here (if needed)

}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

{

    [[KCSPush sharedPush] application:application didReceiveRemoteNotification:userInfo];

    // Additional push notification handling code should be performed here

 //Some processing here

}


- (void) application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error

{

    [[KCSPush sharedPush] application:application didFailToRegisterForRemoteNotificationsWithError:error];

    NSLog(@"didFailToRegisterForRemoteNotificationsWithError");


}


Thank you


Is anyone going to give any info on this problem? 

Mark,

What is the Xcode version? What is the Kinvey SDK version you are using?

Thanks,
Pranav
Kinvey Support

 

Hi Pranav,


The Xcode version is 8 and the Kinvey SDK version is 1.40.7


Thanks

Mark

Mark,

  1. What is the certificate that you have uploaded in the console?
  2. What provisioning profile are you using to sign the app?

 

Thanks,

Pranav

Kinvey Support

Hi Pranav,


1. PushCertificates.p12  is the certificate obtained from the dev account and uploaded in the console


2.In Xcode, preferences/account, there are two provisioning profiles displayed:


iOS Team Provisioning Profile: *

iOS Team Provisioning Profile: MyBundleIdentifier


Please let me know if you need any other info.


Thanks

Reposting the info as it was cut on the margin


1. PushCertificates.p12  is the certificate obtained from the dev account and uploaded in the console

 

2.In Xcode, preferences/account, there are two provisioning profiles displayed:

 

    iOS Team Provisioning Profile: *

    iOS Team Provisioning Profile: MyBundleIdentifier

Mark,

Can you use the codesign tool to check the entitlements on the app bundle?

  1. In XCode, under Project Navigator -> Products folder you will see your .app file.
  2. Right click on .app file and open the "Show File Inspector" to get the full path of the .app file.
  3. In terminal, change directory to the folder that contains .app file using command $ cd <<Full Path to folder that contains .app file>>
  4. Get all entitlements using command $ codesign -d --entitlements :- "YourApp.app"


Do you see the <key>aps-environment</key> listed? If you see it then it means Push Notification settings is properly enabled and the XCode Provisioning profiles are correct.


If the aps-environment or com.apple.developer.aps-environment entitlement is missing, please check your provisioning profile and the Code Signing entity settings.



Thanks,

Pranav

Kinvey Support


 

Thanks so much, your suggestion worked for me. 


mobdro

Login or Signup to post a comment