arleyandrada / PushClient

FREE and Open Source - Titanium PushClient Module
Other
44 stars 17 forks source link

iOS 10 Unable to Register #148

Closed ruscles closed 7 years ago

ruscles commented 7 years ago

I have the same ipa installed on a 9.3.5 device and a 10.0.1 device. Both devices are added to my provisioning iOS profile. The iOS 9 device registers for push notifications correctly and I get a token, but I get the following error on the iOS 10 device after accepting the prompt to receive push notifications:

Sep 13 11:14:47 Test-iPhone[224] <Notice>: [ERROR] eventError:{"code":3,"success":false,"error":"no valid 'aps-environment' entitlement string found for application","bubbles":true,"type":"PushClient_Error","source":{"id":"br.com.arlsoft.pushclient"},"cancelBubble":false}
Sep 13 11:14:47 Test-iPhone[224] <Notice>: [ERROR] Error:

Unable to register this device

no valid 'aps-environment' entitlement string found for application

Is there a different way to enroll for push notifications on iOS 10? I am using PushClient v1.11. Thank you

arleyandrada commented 7 years ago

https://forums.developer.apple.com/thread/54332

ruscles commented 7 years ago

Thanks for the quick response. I made sure to turn this setting on, but I am still getting the same error after packaging for distribution.

image

When I built the Titanium app from the command line directly to the device, I am able to register and receive notifications from the sandbox environment.

arleyandrada commented 7 years ago

I am unable to perform tests for this problem because I do not have a device compatible with iOS 10 at the time, but everything indicates that it is a problem with the SDK Titanium. Probably it is generating errors for all modules that handle push notifications, not only mine.

ruscles commented 7 years ago

I tried rebuilding the app with the latest SDK and CLI and I am still getting the same error. I have opened a ticket with Apple to see if they can help troubleshoot.

christianrockbryan commented 7 years ago

Any update on this? I also am unable to send notifications on my app that's built for iOS 10. Thanks!

ruscles commented 7 years ago

I found out that my app was being resigned with a different certificate before being deployed to an app store. I had to sign the app with the same certificate that was being used to register for push notifications and it worked correctly. This was not on issue on iOS 9 so something must have changed on iOS 10.

christianrockbryan commented 7 years ago

So were you able to now receive notifications on an iOS 10 device? I am still unable to receive, even though the response from the call to APN says successful.

ruscles commented 7 years ago

Yes, I am able to receive push notifications. APN will say successful as long as you are using a valid certificate. If that certificate doesn't match the one on the app, the app will not receive the notification.

Knots23 commented 7 years ago

Has anyone found a resolution to this problem? It's quite hard to debug anything at the moment, as iOS 10 does not show any log messages in Appcelerator (mentioned in Jira and set to be fixed in version 6) and we're unable to register for notifications. (Everything worked before the iOS 10 update.)

christianrockbryan commented 7 years ago

It was a pain, but I was finally able to get it to work by removing and re-creating my provisioning profiles and certificates. After basically starting over and making sure the push permissions were checked correctly, it started working for me.

Knots23 commented 7 years ago

Ah, thanks. It was just a problem with the provisioning profile. Even though Apple didn't mention that there was anything wrong with it, I deleted the existing development provisioning profile, recreated it, downloaded it and added it to XCode. After compiling the app anew, it just worked again.

Edit: but for my second project, it still didn't do the trick. I'll update this once I do find the actual issue.

Edit: I recreated all certificates for this app. During the first run, you need to login for our app. We then register the device for push notification. This part works; Apple shows the pop-up regarding notifications and notification are received. When unsubscribing (via some setting) notifications are no longer received, as expected. Then we try to subscribe again and we never receive a response, even though it is the exact same code as before. Any thoughts on that?

More Edits: When installing the app and logging in, the registration for push notifications works correctly. You can unregister once as well, but after that, we cannot register anymore. As a workaround, we simply do not unregister with Apple (only on our server) when someone opts out for notifications. (Not the correct way, but for now it is a working method.)