Summary:
I followed Push from Scratch and can successfully send a one-time push from my dashboard and receive it in my desktop browser via ionic serve, but when I switch the device token to my iOS device running Ionic View, I don’t receive the one-time push. Why?
Answer:
I read through the entirety of Quick Start and found this note: “Development pushes aren’t native push notifications, and are meant for testing against our API. They’ll work in a browser or emulator…” This seems to indicate that dev push notifications on Ionic View don’t work. It would be helpful if this note was also included in the Push from Scratch documentation.
In the meantime, I have a separate issue of figuring out why my app fails on ‘ionic emulate ios’.
Update:
I also tried the iOS Setup, thinking that maybe I needed a dev certificate, after after completing those instructions, I saw the red box at the bottom that generating a development push certificate is completely unrelated to Ionic Push development mode.
Long version:
I followed along with all the steps on Push from Scratch, and ionic serve works fine, as does ionic upload to Ionic View. However, ionic emulate ios fails with this error code:
** BUILD FAILED **
The following build commands failed:
Ld build/emulator/pushit.app/pushit normal i386
(1 failure)
Error code 65 for command: xcodebuild with args: -xcconfig,/Users/stewart/Code/pushit/platforms/ios/cordova/build-debug.xcconfig,-project,pushit.xcodeproj,ARCHS=i386,-target,pushit,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/stewart/Code/pushit/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/stewart/Code/pushit/platforms/ios/build/sharedpch
Error: /Users/stewart/Code/pushit/platforms/ios/cordova/run: Command failed with exit code 2
I haven’t been able to resolve this error yet and I don’t know if it’s effecting failure of Ionic Push on Ionic View.
Anyway, once I run ionic serve, I then go to my Ionic Dashboard for my app and then go to Push / Testing > One-time Notification.
There I select:
- ‘Development’ for the iOS Certificate
- ‘Device Tokens’ for Delivery Mode.
- I put in a Notification Title
- I copied the device token that logs in my desktop browser console
- I put in a Notification Message
When I send, the notification response looks something like this:
{"errors":[],"message_id":"047760c8bca311e58729c251c9984d2c","result":"queued"}
And then when I click back to the tab with my Ionic app, an alert pops up with the Notification Message, as expected.
However, when do ionic upload and the open up my app on my iOS device, and then in my browser go back to One-time Notification and change the Device Token to be the token corresponding to my iOS device, and then click send, the push notification never shows up on my device.
Any thoughts on why it’s not working?
Thanks!