Development Push vs Distribution Push - ios

We are having some trouble with our push services here..
Our app has been on AppStore for a while, and we wanted to try out our Push for the first time. Not to send to everyone, just to my device.
We followed this guide for setting everything up, and it worked perfectly during development. Later, we did the same thing with distribution when the app went live on AppStore. (perhaps not in that order)
Anyway, we never really tested the push after it went live (our service is kind of a news-service, and is supposed to send a notification to ALL devices when we choose to).
I ran a debug to register my device's token in a different sql-table than the rest, and re-downloaded out app directly from appstore. I do not get prompted for registering for notifications, but I know I did this the first time, and I can even see it in Settings.
I used our .php website to send a message to 'all' devices in the table (currently only my device), and I go nothing. I downloaded the same app on my iPad, and the token was added to the database, sent a new message, and none of them received it.
We added my colleague's token to the same database, he downloaded the app from AppStore, sent the message to all devices in the new table(now three devices), and only HE got the message.
His phone might contain some of the earlier important profiles, but this is all in production, and that shouldn't have anything to say, right?
I now have NO clue what to do. I figure either both my iPhone and my iPad are broken or ignored by the push service, OR my colleague's phone is the only device that will ever receive a notification from this service..?
When I use .php-code to fwrite and send the notification to gateway.push.apple.com, it returns that it successfully sends the message to all devices (but this is also the case even if the app has been deleted from the device.)
I made the .pem file myself, from a newly created request/key/profile etc. from my machine.
Is there a reason why our push service does not send to my devices? Or so far only to his?
Could it have anything to do with certificates, provisioning profiles, keys etc?
EDIT
We have now been trying a whole buch of stuff, and it kind of works now, but I have NO IDEA what happened, and how it works now.
What we did:
My colleague opened his XCode-project, and set everything to Release, and pressed Build. He sent me the AppName.app, and I dragged this to iTunes, and told it to install that app. (The only difference between the AppStore-version and the Xcode-version now, is that DeviceTokens should be registered in another table, as I mentioned earlier). When I launched the app, I noticed that a fourth Token was registered. What I mean by that is that the deviceToken of my device had changed. I know that this happens from time to time, but it shouldn't be a problem. When I tried sending a notification with the new app and the new token registered, I received it. If I UNINSTALL the version he sent me, and re-download the AppStore-version, and send a notification to the NEW device-token, I now receive it.
How?
If I cross check the device tokens in the new with the old table, they are both on both.
The method I used to get a hold of my Device Token in the first place was to build my project with a different url somewhere in it, and I had to delete the AppStore-version first. When running this 'new' xcode-version, it spit out a new token that was never registered with the AppStore-version, so when I tried to reinstall the AppStore-version and send a notification to only that token, it never came through - because the 'current' deviceToken was hidden in the original table, and not in the new one.
The new question:
Why would my deviceToken change from one build to another?
To make a clearer image of what I think happened:
1. AppStore-app launch - Table.regDeviceToken = 111;
2. AppStore-app launch2- Tabke.regDeviceToken = 222; //(it updated itself)
3. Xcode launch - Table2.regDeviceToken = 111; //This is the Token I found and used
4. AppStore-app lauch4 - Table1.regDeviceToken = 222 //This is hidden from me, I thought it would be 111.
5. Send push to Table2.DeviceToken=111; //Which does not work
6. Send push to Table.DeviceToken = 222; //Which works
So, when launching the app in Xcode, I got the OLD DeviceToken. Why would this happen?

Okay, after a lot of headaches due to this problem I have finally found the answer. Our service has functioned properly this whole time.
When I was acquiring my device Token using my Xcode-project, I got a device token made for Development. When I then tried to send a push-notification to this token using our AppStore-app, it did not come through.
When I got the AppName.app file from my colleague, it obviously was in Production/Release-mode, and thus giving the database a DIFFERENT deviceToken.
Bottom line:
An application gives different deviceTokens for Debug vs Release.

Related

My app went from "has one or more issues" to "completed processing" without me touching it. What caused the change?

When I initially tried to submit my app for review in the IOS store, I immediately I received an email saying I had one or more issues with my app. Approximately 10 minutes later, I received another email saying that app has completed processing. I did nothing to change anything in the 10 minutes that elapsed.
I went back to the drawing board and built another version of my app and submitted that about 3 hours later. Only to receive the same rejection response, followed by a "completed processing" email.
Because I wasn't aware of that my initial app completed processing, I ended up using the second version that I created. I was able to submit that version of the app for review.
Here is a screenshot of the initial "issues" email.
Here is a screenshot of the completed processing email for the same app that was submitted just 10 minutes prior.
Since it happened twice in almost the same exact fashion, I believe that it's something on Apple's side. Any ideas how/why this happened or does anyone have experience initially have their app rejected and then 10 minutes later completing the process?
From the first screenshot I can see apple review team has rejected app due to push notification issue.
So resolve it here few things you will need to take care of before submitting new binary :
Make sure your app is using push notification or not
If its not using than disable push notification from APP Id from developer account
Lets say if your app using push notification than make sure its properly enabled on your App Id on developer account & also have proper certificate attached from Push notification distribution
Also make sure that certificate is installed on your system keychain
Go to targets -> Capabilities & switch on Push notification
Now at last make sure you have Push notification frameworks & methods imported properly in to application & its checking the permission alert
Once this all things done than you are good to go with submitting new App version.
Important Note :
Before submitting new version keep Add review note for review team that new have done changes with the push notification issue & now it works fine so Kindly get us approval quickly as possible
Hope it helps.

Why the Flutter phone authentication won't work my real device

I have encountered a strange problem. I'm using the Flutter tool to create my iOS app which requires Firebase phone authentication. I was able to make it work on the other app platform without any fuss, but I'm not able to make it work on iOS real device. As per the documentation, I have to register an APN key from the developer account which I did and added my app's bundle ID too. This key I had to upload in my app console in Firebase which I also did. The REVERSE_CLIENT_ID was entered in the project settings in Xcode too, so the simulator version works flawlessly.
However, when it came to make it work on the real iPhone, I get this issue
flutter: exception code verifyPhoneNumberError message Invalid token.
I just am not able to make out what the issue is. One thing to note is that I had created a native Swift version using same APN key with different App ID for test purpose. Could this be a cause? Should I create a new APN key and will that allow my old App ID?
I got it working by doing a couple of things. I don't really know which one is the actual reason of it working, but along with official docs, I also followed this blog post https://medium.com/flutter-community/flutter-adding-sign-in-with-google-and-phone-authentication-to-your-app-69f681518f9b for help and achieved it due to the blogger's additional help when asked.
Basically I created a new APN key altogether for both push notifications and Firebase phone authentication, then uploaded in Firebase console (removing my old one). Later, the blogger suggested I also enable Background modes for remote notifications in my Xcode project settings. I didn't know this, as I had thought the Push Notifications switch was enough. Anyhow, bam! it started working.

GCM always returns "NotRegistered" for iOS devices

while i never had any issues with android, all my attempts for sending nofifications to iOS fail. everything is properly set up, but the gcm endpoint always returns "NotRegistered" for every iOS reg_id, even immediately after registration.
however, in 1 case it actually did work. compared to ~500 failed attempts, this seems like not working, although I did not change anything between those API requests.
has anyone ever experienced something similar?
nevermind. now it works. i didnt change anything overnight. i can only assume there were some disturbances at GCM / APNS..
edit: and it's not working again (10 hrs later). NotRegistered for every iOS registration token.
I ran into this, happened because xcode decided to use the wrong signing identity or provisioning profile (BuildSettings->CodeSigning->CodeSigningIdentity and ProvisingProfile->Automatic).
IOS uses the signature to match the push notification up to your app and if it's wrong, apple thinks that the app isn't installed or doesn't support push notifications and sends a message back to GCM telling it that the device is 'NotRegistered', which just means the app isn't installed on the device anymore.

Cannot publish iOS push notification certificates changes of a linked iOS app in the Google Play Game Services

I'm using Google Play Game Services for both the Android and iOS version of my game. While the Android version can be set up and used flawlessly, the same cannot be said with the iOS version. I've linked my game and I've entered the relevant data, except for the APNS certificate settings, which I forgot. And then I published the changes. Now, I'm trying to add the certificates, but everytime I tried to re-publish it again, it said "Some changes are not ready to be published yet. " without telling me what those changes are. And when I tried to see what has changed on the "Testing" page, it didn't say anything. There's an "in-out green arrow" in the Linked Apps, Testing, and Publishing sections. So right now I can't republish it with the new APNS certificates, and if I revert back, it will revert back to the linked app without the certificates. I'm confused because it won't let me publish the changes.
Thanks in advance.

Attempting to sent Push Notifications to iOS device - not receiving them

I have so far done the following:
- Generated certificate and private key as .pem, also cat'd them together. Successfully connected to gateway.sandbox.push.apple.com.
- Using the provisional profile with push notifications is enabled for development, I have a basic app that successfully prompted "Do you want to allow push notifications", so this is working correctly
- Obtained the device token
- I have tried pulling a few pre-made files for SSLing into sandbox from the internet just to see if I can get them running before I start development.
The files are the php file posted here: http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12. I actually got a "Message successfully sent"
The python file posted here: Apple PNS (push notification services) sample code; I had to edit the Python 3 command "fromhash" line to str(float.fromhash(...))
I also tried using the PyAPNs API: https://github.com/simonwhitaker/PyAPNs. I still have use_sandbox set to true.
Obviously I changed the device tokens and public keys/certificates to my own. Sadly I have not received any pushed notifications yet, and I'm not receiving any concrete errors to tell me why. If anyone can shed some light, that would be amazing.
From my comment in radesix's answer, and apologies that I can provide no more detail as it's been a year since I've touched iOS development.
The problem was my provisional profile had the "aps-environment" key set to developer, but for some reason xcode defaulted to "debug". Changing this in the editor solved my problem.
Use a service like urban airship (urbanairship.com) and you'll have this up and running in minutes. Less for you to maintain in the long run also.

Resources