Remote notifications for local debugging with Houston and notifications for houston debugging
Background of Houston
Houston
Address on GitHub: https://github.com/nomad/houstonand the author isMattt Thompson
It is simply humane, productive, and quality
Houston allows us to easily debug remote notifications locally or even on terminals.
Install
First install on the terminal:
$ gem install houston
I reported an error during the first installation, but the second installation was successful:
...Installing ri documentation for houston-2.2.31 gem installed
Rungem list
Command to see the houston and its version:
Then you can executeapn
Command:
$ apnerror: undefined method `size' for nil:NilClass. Use --trace to view backtrace
Prepare Certificate
Be prepared before use.pem
Certificate file:
$ openssl pkcs12 -in cert.p12 -out apple_push_notification.pem -nodes -clcerts
If your Keychain Access does not have the Push Services certificate, you may need to download or create one:
1. log on to the iPhone Developer Connection Portal (http://developer.apple.com/iphone/manage/overview/index.action) and click App IDs
2. Create an App ID that does not use any wildcard characters. This is because the wildcard ID cannot be used for the push notification service.
3. Click "Configure" next to the App ID, and then press the button to generate the push notification license. Generate and upload a signature according to the wizard steps, and finally download the generated license
4. Double-click the. cer file to add your aps_developer_identity.cer to Keychain Access.
5. After addingPush Services
Start after the certificatepem
File, steps are the same as above
Then you can test remote notifications on the terminal.
Send remote notification
You mustapn
SpecifyDeviceToken
Andpem
Certificate path.
Common text
For example, test common text notifications:
$ apn push "<d10c67b0 079cfdc0 27b5dd81 2fd537ce 16831f40 ca55fa34 8b14ffde 626435f6>" -c ~/Desktop/apple_push_notification.pem -m "Hello"
Terminal prompt after success:
1 push notification sent successfully
Custom Parameters
Remote notification with parameters:
$ apn push "<d10c67b0 079cfdc0 27b5dd81 2fd537ce 16831f40 ca55fa34 8b14ffde 626435f6>" -c ~/Desktop/apple_push_notification.pem -m "Hello" -d content-id=42
Customize multiple parameters
Multiple parameters are separated by commas:
$ apn push "<d10c67b0 079cfdc0 27b5dd81 2fd537ce 16831f40 ca55fa34 8b14ffde 626435f6>" -c ~/Desktop/apple_push_notification.pem -m "Hello" -d content-id=42,icon=image.png
Silent notification
$ apn push "<d10c67b0 079cfdc0 27b5dd81 2fd537ce 16831f40 ca55fa34 8b14ffde 626435f6>" -c ~/Desktop/apple_push_notification.pem -s "" -n
For silent notificationssound
Set to null string and enablecontent_available
.
Available terminal options
- '-M','-alert ALERT ', 'body of the alert to send in the push notification'
- '-B', '-badge NUMBER', 'badge number to set with the push notification'
- '-S','-sound sound', 'sound to play with the notification'
- '-Y','-category CATEGORY ', 'category of notification'
- '-N','-[no]-newsstand', 'indicates content available for newsstand'
- '-D','-data KEY = value', Array, 'passes custom data to payload (as comma-delimited "key = VALUE" declarations )'
- '-P','-payload payload', 'json PAYLOAD for notification'
- '-E','-environment ENV ', [: production,: development], 'Environment to send push notification (production or development (default ))'
- '-C','-certificate CERTIFICATE ', 'path to certificate (. pem) file'
- '-P','-[no]-passphrase ', 'prompt for a certificate passphrase'