nmyster
nmyster

Reputation: 452

iOS - AWS SNS Endpoint setting to disabled

I have been trying to understand how to create an app that will receive push notifications from an AWS SNS set up.

I have created the app certificates etc and from what I can see, things should work. I have followed some tutorials and also managed to get my iOS app to receive push notifications sent to APNS from a PHP script run locally on my dev machine.

The thing I appear to be missing is that when I try to set up my AWS SNS app to publish a message to my development device endpoint, it changes the state from Enabled to disabled without any reasoning or error messages coming from the AWS console.

My understanding is that the device token I am using is correct as the PHP script works, my certificates etc are working as this would mean the PHP script would not work and that I must be missing something between the AWS setup and iOS set up.

Some Code:

iOS Setup - works as notifications received from PHP script

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.


    let defaultServiceConfiguration = AWSServiceConfiguration(region: AWSRegionType.EUWest1, credentialsProvider: credentialsProvider)
    AWSServiceManager.defaultServiceManager()
        .setDefaultServiceConfiguration(defaultServiceConfiguration)

    let notTypes:UIUserNotificationType = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound
    let noteSettings:UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notTypes, categories: nil)

    UIApplication.sharedApplication().registerUserNotificationSettings(noteSettings)

    return true        

}

func application(application: UIApplication, didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings) {
    UIApplication.sharedApplication().registerForRemoteNotifications()
    println("hello from user")
}


func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
    println("recieve!!")
}

AWS Screenshot enter image description here

If anyone can think of or notice something I am missing here it would be greatly helpful in my learning process!

Upvotes: 4

Views: 1972

Answers (2)

praveen
praveen

Reputation: 57

I faced similar problem. I had all of the setup correct, but I missed enabling the remote notification entitlement in the plist. Once I enabled this, the problem was rectified.

Upvotes: 0

geppy
geppy

Reputation: 604

I'm guessing that it's a certificate issue. Try creating and using a new one. I had similar problems that ended up being resolved by generating a new certificate (despite the old one working in a third-party test tool).

Upvotes: 3

Related Questions