JetLobster ruby local APNs testing tool

published in iOS Development, Tutorials
by Slawomir Onyszko

Are you working on an iOS mobile app and have to check if all of the programmed notifications work correctly? Keep on reading: JetLobster ruby local APNs tool can easily test the service of notifications in your iPhone app.

Testing the notification service isn’t difficult. Although, in our case, it happened to be impossible. Why? Functionalities on the back-end side weren’t ready yet, and that’s why we needed a tool that would help us send real notifications in a quick and easy way.

How did I make JetLobster ruby local APNs testing tool?

I came up with an idea to write a ruby script which will make it possible. The main goal was to make everything work efficiently and flexibly. Creating the script took me only a few minutes. To send notifications to APNs, I’ve used a gem called APNS – it happened to be easy and at the same time, it provided everything that I needed. Additionally, I’ve used the OptionParser gem to parse parameters in a terminal. Thanks to that the tool became more functional and user-friendly.

Next steps of testing the notifications

To send the notification I needed an application with configurated APNs services, generated *.pem file and the tool’s token (that I’ve managed to get after registering the service). The script requires ruby and bundler. After cloning a repository, it was needed to move on to a directory and run bundle install command. All that had to be done, was to run the script with a minimum of 3 parameters.

ruby jet_lobster.rb --pem "PathToYourPemFile.pem"  
--token DEADC00FE --message "JetLobster is awesome!"

With the --pem option I gave a path to our pem file, --token. Here I’ve provided tool’s token, and in --message, a notification message. In the above command, I didn’t use --other option – but if used, it helps to send an extra data that is placed in a notification. Exemplary:

ruby jet_lobster.rb --pem "PathToYourPemFile.pem" 
--token DEADC00FE --message "JetLobster is awesome!" 
--other "{:sent => 'with JetLobster'}"

Remember that when providing the data, you must use ruby syntax creating Hash.

And that’s it. In my opinion, JetLobster ruby local APNs is an easy, quick and flexible tool to test the service of notification in an iOS app.  And how do you like it?

Check out other iOS development tutorial on our blog: Core ML: Machine Learning for iOS.

 


You can find the source code on my Github.


 

Slawomir Onyszko Mobile Developer

Sławek is our mobile developer who mostly takes care of creating Android applications. He is constantly enhancing his skills of advanced Android app development and he wants to share this knowledge via Zaven’s blog. In his spare time Sławek enjoys watching a good movie at the cinema.

Popular posts

Clutch Announces Zaven as Top Polish Development in  2019 Eastern European Leaders Award

Clutch Announces Zaven as Top Polish Development in 2019 Eastern European Leaders Award

Since 2011, Zaven has been providing digital solutions for global clients. Our team is composed of experts in custom development, UX/UI design, data analytics, backend integration and more. We aim to build long-term business relationships with our clients in order to create the highest quality and most innovative solutions. Clutch, a B2B market research platform, […]

Read more
How to overcame the fear of hiring outsourced developers?

How to overcame the fear of hiring outsourced developers?

There is many a legend about outsourcing which successfully keeps away entrepreneurs. Stories about software which never even existed, despite the fact that the developer had promised that everything was fine - even ahead of deadline. No communication with the developer for a long, long time and then it turns out that nobody has been working because it is Chinese New Year! These are telling examples and they are not isolated. I can only imagine the fear that grips some people when the subject of outsourcing steps out of the shadows! Let’s just deal with the most common fears of hiring outsourced developers.

Read more
Why we moved to Kotlin for Android development (and maybe you should too)

Why we moved to Kotlin for Android development (and maybe you should too)

Recently Kotlin programming is really endorsed by Google and most of the developers. We are not an exception. We moved to Kotlin for Android development and it was worth it. Here are 8 reasons why we did it.

Read more
Mobile Apps

Get your mobile app in 3 easy steps!

1

Spec out

with the help of our
business analyst

2

Develop

design, implement
and test, repeat!

3

Publish

get your app out
to the stores


back to top