Meteor-Community-Packages / raix-push

DEPRECATED: Push notifications for cordova (ios, android) browser (Chrome, Safari, Firefox)
https://atmospherejs.com/raix/push
MIT License
514 stars 197 forks source link

Got error code 8 for token [...] #145

Closed lucnat closed 8 years ago

lucnat commented 8 years ago

I am in the process of deploying my app to the app store. I have tested all certicates and keys (development and production) and they are fine. Push works perfectly in development. However, when I set NODE_ENV to production and also "production": true in config.push.json, it won't work anymore. Upon sending a push notification, I get the following error:

[46.101.207.204] Push: Sent message "Laptop" to 1 ios apps 0 android apps[46.101.207.204] 
[46.101.207.204] Got error code 8 for token e4f493fa53f80ecceb8351c878b028caa91bd050d1c075a9f385deb4b24a9750[46.101.207.204] 

I can imagine that this happens because the app has been installed via xcode on the device. Can anybody confirm? Will the message disappear once the app has been installed through the app store? And what is the correct push setting to use with Apple TestFlight?

lokiribeiro commented 4 years ago

Nope, still getting error code 8.

da314pc commented 4 years ago

let me see the push configure you have on the server

lokiribeiro commented 4 years ago

Push.debug = true;

Push.allow({ send: function(userId, notification) { return true; // Allow all users to send } });

Push.Configure({ // Google Cloud Messaging apn: { certData: Assets.getText('finalpush.pem'), keyData: Assets.getText('finalkey.pem'), passphrase: '', gateway: 'gateway.push.apple.com' }, gcm: { projectNumber: , apiKey: "***" }, production: true, sendInterval: 2000 });

da314pc commented 4 years ago

so 2 things, in your build in xcode make sure you have push enabled

ca_enablepushnotifications

then check: That is most probably a problem with your provisioning profile, you have to solve it in developer.apple.com, you go to account -> click on Certificates, Identifiers & Profiles -> click on identifiers - app ids -> select your app -> click on edit -> select push notifications.

lokiribeiro commented 4 years ago

can we use p8 with raix now? if so, where could I read more about this?

da314pc commented 4 years ago

I think so, did you check the identifiers?

lokiribeiro commented 4 years ago

yup, i got them all set properly: Screen Shot 2020-02-05 at 2 52 07 PM

and here is from my xcode: Screen Shot 2020-02-05 at 2 52 25 PM

da314pc commented 4 years ago

it has to be the old device token. Clear the collections again

lokiribeiro commented 4 years ago

I cleared it and tried to push again, still getting error code 8:

Push: Send message "Engineer on watch" via query { userId: 'kL2QqFdDTHfQsQbTH' } send to token { apn: 'cAVqXUkdFLc:APA91bGhp8ldMkeTNwlLb6yQWoGyPYEXRkJEK_84OSJHH4EJwcuquRlG_dt0Ywfnaoo7rXZEAXLUpMSRaNO6jlWpYWFgjIywiAbAgMTwItLfsgJ_Li-OZvwx9KzDjKVDqy9s5t5792ks' } Push: Sent message "Engineer on watch" to 1 ios apps 0 android apps Push, GUIDE: The "Push.appCollection" - No GCM clients have registred on the server yet... Got error code 8 for token cAVqXUkdFLc:APA91bGhp8ldMkeTNwlLb6yQWoGyPYEXRkJEK_84OSJHH4EJwcuquRlG_dt0Ywfnaoo7rXZEAXLUpMSRaNO6jlWpYWFgjIywiAbAgMTwItLfsgJ_Li-OZvwx9KzDjKVDqy9s5t5792ks

da314pc commented 4 years ago

Application has the entitlement key production, checked from the mobile.embeddedprovision

da314pc commented 4 years ago

the error code means the something is point to the sandbox environment, so we at least now the cause we just have to keep going through checks.

lokiribeiro commented 4 years ago

Alright, Thanks.

Where do I find the mobile.eembeddedprovision?

Though I could see the aps_environment during distributing the app in xcode like this: Screen Shot 2020-02-05 at 12 57 03 PM

da314pc commented 4 years ago

platforms/ios/APP_NAME/Entitlements-Release.plist platforms/ios/APP_NAME/Entitlements-Debug.plist

da314pc commented 4 years ago

make sure you have production set.

lokiribeiro commented 4 years ago

weird, i dont seem to have an embedded.mobileprovision file.

lokiribeiro commented 4 years ago

Oh I found it:

aps-environment production
da314pc commented 4 years ago

https://github.com/phonegap/phonegap-plugin-push/issues/1408#issuecomment-355190714

da314pc commented 4 years ago

Make sure it doesn't get overwritten

lokiribeiro commented 4 years ago

Screen Shot 2020-02-05 at 3 25 26 PM

da314pc commented 4 years ago

what version of xcode?

lokiribeiro commented 4 years ago

Should the Entitlements-Debug.plist have development? Screen Shot 2020-02-05 at 3 26 25 PM

lokiribeiro commented 4 years ago

Here's my xcode version: Screen Shot 2020-02-05 at 3 27 49 PM

da314pc commented 4 years ago

did you do xcode legacy build? https://github.com/apache/cordova-ios/issues/407 In Xcode, go to: File -> Project Settings (or Workspace Settings)-> Build System

From there you can select New Build System (Default) or Legacy Build System

da314pc commented 4 years ago

are these: certData: Assets.getText('cert.pem'), keyData: Assets.getText('key.pem'),

the production certs you made?

da314pc commented 4 years ago

change Should the Entitlements-Debug.plist have development? to production. This sets the environment.

lokiribeiro commented 4 years ago

yup. they are the production certs I made. And yes I set both Entitlements files to production now. Rebuilding them and will submit to testflight again

da314pc commented 4 years ago

set the Entitlements-Debug.plist to prod change the string to production, then rebuild and upload to the store

lokiribeiro commented 4 years ago

Alright, will do it. thanks. I'll let you know how it turns out. Hopefully this should work now

lokiribeiro commented 4 years ago

Unfortunately still getting error code 8. I really don't understand tho, all my environment variables are correct, my certificates are correct too. At this point I might try using p8 files to see if it would get rid of the error code 8

da314pc commented 4 years ago

You could try.

lokiribeiro commented 4 years ago

Thanks for all the help. Been stuck here for months.

da314pc commented 4 years ago

I"m still wondering if its the device. If you install the app from the testflight app, it should be fine. I guess you could try p8 files for a different result. IF we get the same result then we know its the device.

da314pc commented 4 years ago

np.

lokiribeiro commented 4 years ago

I'll try a different device and see if it would work. Im testing on an IOS 13 device

da314pc commented 4 years ago

Try to a different device with the same build. I think something on xCode is not setting it be a production environment, I feel your certs are fine.

lokiribeiro commented 4 years ago

I tried a different device and I still get an error code 8. This is really weird as I've tried a lot of "solutions" already like redeploying in server, testing the certificates, checking the app ID is the same, etc

da314pc commented 4 years ago

paste your signing a capability push notifications section

da314pc commented 4 years ago
fXDDh
da314pc commented 4 years ago

Make sure you see that when your about to distribute.

lokiribeiro commented 4 years ago

alright here's the signing and capability:

Screen Shot 2020-02-06 at 12 58 24 AM

and before distribution:

Screen Shot 2020-02-06 at 1 08 58 AM
da314pc commented 4 years ago

try to upload this to the app store

lokiribeiro commented 4 years ago

I cant make this work so I used p8 files instead and I finally am able to get notifications on both development and production. Thank God.

lokiribeiro commented 4 years ago

and thank you as well for helping me out

da314pc commented 4 years ago

Np, Apple stopped making p12 files, but I didn't think they wouldn't no longer work with production. I guess we should check into any official announcement. Glad everything works now.