3

Per the title, I'm trying to get AWS SNS push notification to work on iOS device. For testing purpose I wanted try the Mobile Hub (https://console.aws.amazon.com/mobilehub) and work my way on top of the sample app that's given.

I just can't seem to make it work. I know it's difficult to ask for help when it involves a multi layered instructions, but I've spent all weekend wrestling this issue, and just couldn't seem to figure it out. In AppDelegate, didReceiveRemoteNotification call should receive something when I trigger an SNS within Amazon SNS Mobile Console after selecting a Topic. But this protocol is not being called.

  1. In terms of Provisioning Profile, I've created both Development & Distribution. Tested with both.
  2. In terms of certificates I have tried with both Apple Push Notification service SSL (Sandbox) and Apple Push Notification service SSL (Sandbox & Production). It's obvious you have to select the latter since with the former, the notification permission alert doesn't even show when you install the app. Only does it show when you've installed it with the latter.

  3. I made sure the bundle IDs match.

  4. I've turned on all my notifications on my iphone 6s.

  5. On console I see this success message:

2016-03-30 20:57:57.103 MySampleApp[284:47861] AWSiOSSDKv2 [Info] AWSPushManager.m line:186 | -[AWSPushManager interceptApplication:didRegisterForRemoteNotificationsWithDeviceToken:] | The device token: 435d5se354s38s9ddge2edcs2a3601e18ss9c83e47s629164ebced21s16abb39974sg3

  1. "didFailToRegisterForRemoteNotificationsWithError" never gets called.

  2. "didRegisterForRemoteNotificationsWithDeviceToken" successfully gets called.

  3. I also get this success message on my console:

2016-03-30 21:34:16.635 MySampleApp[321:57551] AWSiOSSDKv2 [Info] PushNotificationViewController.m line:112 | -[PushNotificationViewController topicDidSubscribe:] | Successfully subscribed to a topic: AWSPushTopic: 0x14c6da770

I'm absolutely lost. Please let me know if there is more info for me to post to solve this issue.

Update: Rohan Dubal, thanks for the comment. Here are the following things you asked me for.

  1. Yes, I have always went from "My Sample App" navigationbar view -> "Push Notifications" row -> "Push Notifications" navigation bar view -> click Demo Push Notifications on the bottom -> the toggle is on (green) and the "topic" line is checkmarked and I have sent the APNS to that referring Topic.

  2. Yes I've tried minimizing and also closing the app as well. The top bar notification or any notification doesn't show at all.

Thanks for your feedback. Please do suggest any other tests I can run.

Also, I thought that maybe it has to do w/ my iphone 6s so i tried it w/ iphone 5s and it still doesn't work. iphone 6s is ios9.2 and iphone 5s is ios 8.3.

shle2821
  • 1,856
  • 1
  • 19
  • 26
  • 1
    Hi, which View of the app was open when you published through the console? Could you try the following two things and post the results on that? 1. Go to Push Notifications --> Click "Demo Push Notifications" In the view thats visible you should be able to see the topic the device is subscribed to. Please make sure you are on that View and then publish on the subscribed topic. 2. Minimize the app and try publishing to the subscribed topic. Note: The default subscribed topic is the all devices topic. so publish to that topic. – Rohan Dubal Mar 30 '16 at 17:05
  • @RohanDubal, I just added your suggestions. I appreciate it. But sadly no progress. Please do suggest other tests I can run. Thank you. – shle2821 Mar 30 '16 at 17:23
  • 1
    Were you able to see a tick besides the all devices topic? Did you publish on the same topic you got a tick on? If the app is running, you need to be in the PushNotificationsViewController for the notification to show up. – Rohan Dubal Mar 30 '16 at 17:28
  • Within PushNotificationViewController, I do see the check mark on the right of the Topic row. And I send my message to exactly that Topic. – shle2821 Mar 30 '16 at 17:32
  • @RohanDubal, thanks for the feedback. Any further suggestion is highly appreciated. – shle2821 Mar 30 '16 at 17:34
  • I have recently changed from an Individual Developer Account to a Corporate Developer Account. But I have never changed my email address. I'm using the same one. When I visit my Keychain Access, I see two sets of Team ID (something that looks like 4B1A12J8HK). Could this be an issue? If so, how would I eliminate the old (Individual ID). Somehow, whenever I try to delete it, it comes back when I restart Xcode. – shle2821 Mar 30 '16 at 17:59
  • Hi, could you please post this in the AWS Forums under Mobile Development? We would be able to help you better there by taking a look at your resources and configuration. Thanks! – Rohan Dubal Mar 30 '16 at 20:26

1 Answers1

3

Well, this sounds similar to the problem that I was just having. Mobile Hub only seems to let you setup Production APNS and not Development ones. When I debug the app with XCODE I'd need to use the sandbox APNS, so I did the following:

  1. Create an SNS Application of type Apple Development (APNS_SANDBOX)
  2. Use the .p12 from my Development Certificate in the App ID
  3. Started my App and recorded the device token that didRegisterForRemoteNotificationsWithDeviceToken gave me
  4. Minimised my App (otherwise notifications don't appear)
  5. in SNS console I registered an Endpoint using the device token
  6. Used the Publish to this Endpoint button in SNS console to send a message ('Hello World', obviously)
  7. Saw notification
  8. Did engineers victory dance

Hopefully that helps you. The key to this for me was realising that I'd need to create another SNS queue. TBH I'm not seeing the benefit of the Mobile Hub.

Chris Kemp
  • 2,069
  • 2
  • 18
  • 27
  • thanks!! I since this was written many months ago, I just went w/ implementing the APN w/ my server without going through amazon. It felt like it it was just too much hassle. Thanks!! – shle2821 Sep 14 '16 at 08:02
  • np. Hopefully it will be helpful to those that follow in our footsteps. Can you accept the answer if it's correct, so that people know. – Chris Kemp Sep 27 '16 at 21:18