When I'm trying to register notification by using this code (which is from the official document)

in application:didFinishLaunchingWithOptions:, I register the push notificaiton


and then

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { // This is how I register Apple’s push notification service
// Once I get the device token, I’ll pass it directly to Salesforce
    SFPushNotificationManager.sharedInstance().didRegisterForRemoteNotifications(withDeviceToken: deviceToken) // #1

    if SFUserAccountManager.sharedInstance().currentUser?.credentials.accessToken != nil {
       let result = SFPushNotificationManager.sharedInstance().registerForSalesforceNotifications() // #2
       print(result) // result is true

But after a couple of seconds calling this method, I always get an error response from Salesforce

2018-10-19 17:41:56.367477 Registration for notifications with Salesforce failed with status 404
2018/10/19 06:41:56.360 ERROR com.salesforce : Response:(
errorCode = "NOT_FOUND";
message = "The requested resource does not exist";

I've tried to config the app to sandbox mode, using p12 file for both development and production, and both of them gave me the same error.

Any idea on this?


I got the same error and when I added the Consumer key and redirect URI in the app. I am able to register my device. We can confirm this by looking at Mobile Push Registrations on the user.

SalesforceSDKManager.shared().connectedAppId = "ConsumerKey"
SalesforceSDKManager.shared().connectedAppCallbackUri = "sfdc://success"

But, when I do test notification from connected app, I get TLS HandShake error. I am looking into this, will keep posted

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.