Remote notifications for local debugging with Houston and notifications for houston debugging

Source: Internet
Author: User

Remote notifications for local debugging with Houston and notifications for houston debugging
Background of Houston

HoustonAddress on GitHub: https://github.com/nomad/houstonand the author isMattt ThompsonIt 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 listCommand to see the houston and its version:

Then you can executeapnCommand:

$ apnerror: undefined method `size' for nil:NilClass. Use --trace to view backtrace
Prepare Certificate

Be prepared before use.pemCertificate 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 ServicesStart after the certificatepemFile, steps are the same as above

Then you can test remote notifications on the terminal.

Send remote notification

You mustapnSpecifyDeviceTokenAndpemCertificate 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 notificationssoundSet 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'

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.