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.
Popular posts
From Hype to Hard Hats: Practical Use Cases for AI chatbots in Construction and Proptech.
Remember the multimedia craze in the early 2000s? It was everywhere, but did it truly revolutionize our lives? Probably not. Today, it feels like every piece of software is labeled "AI-powered." It's easy to dismiss AI chatbots in construction as just another tech fad.
Read moreFears surrounding external support. How to address concerns about outsourcing software development?
Whether you’ve had bad experiences in the past or no experience at all, there will always be fears underlying your decision to outsource software development.
Read moreWhat do you actually seek from external support? Identify what’s preventing you from completing a project on time and within budget
Let’s make it clear: if the capabilities are there, a project is best delivered internally. Sometimes, however, we are missing certain capabilities that are required to deliver said project in a realistic timeline. These may be related to skills (e.g. technical expertise, domain experience), budget (hiring locally is too expensive) or just capacity (not enough manpower). What are good reasons for outsourcing software development?
Read more