Skip to content

Commit

Permalink
[doc] Show how to test Push Notifications nowadays.
Browse files Browse the repository at this point in the history
  • Loading branch information
alloy committed Jan 7, 2016
1 parent eb2f074 commit f4f1fb2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gem 'cocoapods-keys'
gem 'nokogiri', '1.6.7.rc4'

group :development do
gem 'houston'
gem 'lowdown'
# Depends on older xcodeproj gem that is incompatible with current CocoaPods.
#gem 'synx', :git => "https://github.com/orta/synx", :branch => "spaces_to-underscores"
end
Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ GEM
terminal-table
xcpretty (>= 0.2.1)
highline (1.7.8)
houston (2.2.3)
commander (~> 4.1)
json
http-2 (0.8.0)
http-cookie (1.0.2)
domain_name (~> 0.5)
i18n (0.7.0)
json (1.8.3)
lowdown (0.0.4)
http-2 (>= 0.8)
match (0.2.4)
cert (>= 1.2.7, < 2.0.0)
credentials_manager (>= 0.13.0, < 1.0.0)
Expand Down Expand Up @@ -186,7 +186,7 @@ DEPENDENCIES
deliver
fui
gym
houston
lowdown
match
nokogiri (= 1.6.7.rc4)
pilot
Expand Down
37 changes: 12 additions & 25 deletions docs/push_notifications.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
# Sending a push notification to your development build
# Sending a push notification to your beta/development build

Sorry open-sorcerers, this requires specialised provisioning profiles and private certificates, so these steps won’t work for you.
Sorry open-sorcerers, this requires our APNS certificate, so these steps won’t work for you.

1. Get the required ‘Artsy Development APN’ certificate from the 1Password vault or
1. Get the required ‘Eigen Apple Push Notification Certificate’ certificate from the 1Password vault or
[the Gravity repo](https://github.com/artsy/gravity/raw/master/config/apns/net.artsy.artsy.dev.pem)
and store it somewhere locally.

_Do **NOT** commit this file to the Eigen repository, but, just in case, the file `net.artsy.artsy.dev.pem` in the
root of the repo is ignored._

2. On startup, the app will register with APN and log the current device token, which will look like:
2. Either retrieve your device token
* from a beta build by opening the developer menu (by shaking your device) and select ‘Copy Push Notification Token’,
which stores the token on your device’s pasteboard.
* or from a development build by searching the console logs for `Got device notification token: <token>`.

Got device notification token: b37e50cedcd3e3f1ff64f4afc0422084ae694253cf399326868e07a35f4a45fb

3. Ensure the app is not currently active. (Notifications for active applications are not shown.)
3. If you wish to test iOS notifications coming in and/or test the app icon badge count updating, ensure the app is not
currently active. (Notifications for active applications are not shown.)
If you wish to test the Eigen custom notification banner, ensure the app is currently active.

4. Send a notification, using the locally stored certificate and your current device token:

$ bundle exec apn push [TOKEN] --environment development --certificate path/to/certificate.pem --alert 'The “earth” without “art” is just “eh.”'

5. For more options, such as app icon badge number, sounds, etc, see:
$ bundle exec lowdown <token> --certificate path/to/certificate.pem --alert "Hello World!" --badge 42 --data url=https://www.artsy.net/artwork/brian-kernighan-hello-world

$ bundle exec apn push --help
If you are testing against a development build, be sure to add `--environment development` to the above command.


### Further reading
Expand All @@ -30,17 +31,3 @@ Sorry open-sorcerers, this requires specialised provisioning profiles and privat
https://developer.apple.com/library/ios/technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG21


### Troubleshooting

If the application does not deploy to your device:

* Ensure the right provisioning profile is being used for the debug build (‘iOSTeam Provisioning Profile: net.artsy.artsy.dev’)

* Ensure your device is listed in that provisioning profile with:

$ security cms -D -i ~/Library/MobileDevice/Provisioning\ Profiles/UUID.mobileprovision > /tmp/net.artsy.artsy.dev.profile
$ /usr/libexec/PlistBuddy /tmp/net.artsy.artsy.dev.profile -c 'Print :ProvisionedDevices'

(You can locate the profile by going into Xcode > Preferences > Accounts > ‘ART SY INC’, right-click it, select
‘Show in Finder’, and drag it to your terminal.)

0 comments on commit f4f1fb2

Please sign in to comment.