stewartm
stewartm

Reputation: 309

Ionic Push works with ionic serve but not Ionic View

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?

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. Of note is that I installed 'ionic plugin add phonegap-plugin-push' as part of the instructions for using Ionic Push. Running 'ionic serve' works fine for testing the app in a desktop browser, as does 'ionic upload' to Ionic View (an iOS app for viewing/testing on-device). 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:

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 then 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!

Upvotes: 2

Views: 1027

Answers (1)

stewartm
stewartm

Reputation: 309

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 (and explains why the dev push notifications do work on the desktop browser. 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'.

Upvotes: 0

Related Questions