Kodeco Forums

Push Notifications Tutorial: Getting Started

In this push notifications tutorial you'll learn how to notify your users and perform small tasks even when they arenā€™t actively using your app!


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/584-push-notifications-tutorial-getting-started

Is there any particular reason for using certificates instead of APNS Auth Keys which is recently released by Apple? A single auth key works for multiple apps and it never expires.

Depends on the service you are using to generate the push notification. Looks like Pusher only supports certificates at the moment. As keys are a new feature it may take some time for third party providers to adopt them.

Hi, I followed along with the tutoral until the section telling me to use Pusher.
The word Pusher is bolded, but is not a hyperlink.
I didnā€™t see pusher on my mac, so Iā€™m assuming itā€™s not part of xcode,
I checked the app store but did not see it.
Thereā€™s a pusher service, but that doesnā€™t appear to have the app.

Also if anyone is part of a corporate developer program, I had some questions around that -
The instructions in the tutorial tell us to go to the developer portal to get a certificate.
In xcode (8.3.3) under Project->General->Signing, I have ā€œAutomatically manage signingā€ checked.
In the apple developer portal website, the option to edit any of my settings is grayed out (this could be a permissions issue, itā€™s my first time using this)

Iā€™m not sure about others, but I know I could use a bit more detail in the tutorial around this area of how to send the notification to Apple, especially tips related to hot to send a message to APNS from a web server. Otherwise the articleā€™s been great so far!

Pusher link is at the end of the sentence, you can get it here: GitHub - noodlewerk/NWPusher: OS X and iOS application and framework to play with the Apple Push Notification service (APNs)

As for the code signing, I understand the confusion (it is a confusing topic), but our goal was to focus on push notifications. You can check your role in Xcode settings: if your role is Member, you wonā€™t be able to edit these settings, and youā€™ll need to talk to someone with higher privileges.

Excellent! thanks for the clarification!

I was just a ā€˜memberā€™ so Iā€™ve reached out to someone at work and will get it changed.

I also appreciate the link to the pusher tool!

I still donā€™t see the link to it the article, is the most current version of the article posted?

-Jack
PS (Great tutorial!)

Great tutorial. Iā€™m curious if itā€™s possible to send a push notification with only a badge value (no alert, no sound)? Does Apple allow simply leaving out those fields?

Why not objective-c :frowning_face:


Great Tutorial ā€¦ Thanks !!

I am new to iOS Developmentā€¦ Can you please help me with the Following :slight_smile:
Since we have used APNS to receive the notificationā€¦ How can i use it with for the VoIP Notification ?

How to implement our own server instead of using pusher? I hope to do it using a personal server running on EC2 on Golang. I do not expect you to give me the code for it. But just a bit explanation and few links.

Can you please show how to use PushKit for sending notification for normal apps that do not use VoIP feature.

Thank you Jozsef this was a great tutorial. I found it very helpful and easy to follow!

I would need to send the notifications from my back office server on Centos. All the python libraries I tested give several errors when trying to send a notification and a node one I also tested does not allow to submit a payload. Is there a full tested version to suggest?

@jozsef.vesza Can you please help with this when you get a chance? Thank you - much appreciated! :]

Thanks for the tutorial! FYI, in order to get rid of a ā€œUI call made in the backgroundā€ error/exception, I added calls to DispatchQueue.main.async as shown below:

func registerForPushNotifications() {
    UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { (granted, error) in
        Log.msg("Permission granted: \(granted)")
        
        guard granted else {
            return
        }

        DispatchQueue.main.async {
            self.getNotificationSettings()
        }
    }
}

func getNotificationSettings() {
    UNUserNotificationCenter.current().getNotificationSettings { (settings) in
        Log.msg("Notification settings: \(settings)")
        
        guard settings.authorizationStatus == .authorized else {
            return
        }
        
        DispatchQueue.main.async {
            UIApplication.shared.registerForRemoteNotifications()
        }
    }
}

I am new in Swift 3 but this tutorial is great. I just would like to know how to use it for Distribution. Using Pusher app I need an specific token for one device. After I have generated an certificate for distribution, how do I send push notification this way? Thank you.

hello
followed your tutorial and its working great,thank you. however i have a problem: if i accept to receive notifications on app start, no problem all is working. but if i refuse, then my webview is not loaded. what and where should i had to continue the launching process if autorisation are refused ? currently it stop on "ā€œpermission granted: falseā€

thank you for your help

Hi All,

I am working as Native Android and iOS developerā€¦ I want to know I was reading over stackoverflow that Push notification for iOS app is not allowed without APNSā€¦

So my question here is how FCM works for push notification for iOS appā€¦ please check below links:
https://firebase.google.com/docs/cloud-messaging/ios/client

https://firebase.google.com/docs/cloud-messaging/ios/receive

So can we do this by our selvesā€¦? meaning creating by own programā€¦ I was also reading Local Notification, XMPPā€¦

Can we do it without APNS?

Thanks,
KB


Hey everyone, just letting you know that the starter project from that link doesnt compile anymore.
Is there any push notification tutorial, that still works?

Kind regards
Leon

Here is the solution to solve this building failed problem.

1 Like