The course is part of this learning path
This course explores how to enable push notifications in your iOS apps. We're going to walk you through how to do that using an Instagram clone that we created in a different course.
This course is designed for anyone who wants to:
- Learn about iOS development and coding
- Move into a career as an iOS developer
- Master Swift skills
To get the most out of this course, you should have some basic knowledge of iOS.
Hi. Within this lecture, we're going to send our first manual push notification using One Signal dashboard. So, now we have everything we need in our app. We have configured our app to be capable of sending push notifications and now we are ready. So, in order to test this, we have to use a real iPhone device as I said before. So, as you can see there is this final option to install the SDKs and we have already done that. And here you will see a box saying that you have to check the subscribed users. So, it's kind of optional but it's nice to do that. So, what does it mean to be subscribed? So, when you accept some push notification service from some app, you get subscribed to the push notifications of that particular app. So, it's kind of a YouTube. So, you subscribe to that app. You subscribe to the push notifications and the developer, in this case, we will publish some apps, some push notifications and you will receive that push notifications once we publish. Okay. So, this is kind of a publisher subscriber relationship. So, let me come over here and plug my iPhone, okay, with USB and as you can see, it appears over here so that I can choose it and I can run it on my phone and also I'm going to bring in my phone using QuickTime player, so that you can actually track what's going on inside my phone as well and, yup, this is my dog and it will take some time because we are doing this for the very first time and it's actually building a lot of tasks as you can see. Now we have run this in our simulator before, but it's the first time that we are running this on our phone, so it may take some time. So, feel free to pause the video and come back when it's done. So, after it's done, I'm going to open my app and it's going to ask me for a push notification permission. As you can see, once I see the app running on my phone, it asks me for a permission. So, once I hit the allow button on my phone, I will get subscribed to the push notifications and in fact, I can see them over the One Signal dashboard. Okay. So, once you do that, you can go back to your One Signal and try to see if this is logged in or not. So, let me log in by the way with James in my phone. So, firstname.lastname@example.org. Okay. And it's taking a little bit time as you can see because I'm really typing on my phone rather than my simulator over here. So, I'm going to click on this sign in button and it will just take me inside of my app and as you can see now I'm seeing everything that we have built in the previous section. Now, I can come over here to upload something and so, now let me go back because we are not interested in the Instagram features right now but we are interested in the push notification features. So, it's time to test if we can, if we could subscribe or not. Okay. You can do that over the first screen that we have seen over here and if you have closed this for some reason I will show you how to do that. And as you can see, once I say check subscribed users, it couldn't find the subscribed users even though I'm sure I have given the permission to do so. So, if you didn't get this error, if you have seen, yup, successful you have one subscribed user then it's okay for you. But if you didn't see it, if you didn't see any subscribed users like me, I will show you how to handle this. So, I'm gonna come over here and I'm just going to say check subscribed users one more time and it's clearly not working for me. So, I'm going to leave the set up and I'm going to go into my dashboard. And in here, this is the dashboard of my Instagram Firebase, you can just click on the app name and if you come into the main dashboard for some reason, you can click your app name as well in order to reach your apps dashboard and here you will see, we really don't have any subscribed users. So, we have only zero subscribed users, so it clearly doesn't work. So, I'm going to update my pods. I'm going to update my repository, so that if there is any change in the pods and so that I can just update it and I can use the latest version. And you can come across with this kind of problem especially when its transitional periods like this. So, now we are moving into IOS13 and I believe there is some sort of bug but we're going to come over this problem. So, I'm going into my IOS complete folder to find my Instagram Firebase. So, I'm going to run pod update over here or you can run pod install repo update. Okay. So, this will update your pods and if it doesn't work for you again, please run pod install repo update like this, so that it will update your pods. It will update your current project folders. And again, please make sure you select the latest version you see over here rather than using mine, so that you won't be using an outdated version. So, if the codes change by time, of course, I'm going to update this lesson anyway but if it doesn't change, you have to use the latest version in order to ensure stability in your app. So, after this is completed, I'm going to delete my application from my iPhone because I'm going to install it one more time and it will ask me to give some permissions and once I do that, I will see if this is subscribed or not. So, here you go. Now, it's updated for me. So, let me plug in my iPhone and after you delete the existing app from your phone, you can just try to run this one more time. So, let me run this. Okay. And let me go back to my phone to see it. And I believe it's going to be fast this time because we have already built this but we have updated the pods as well so I'm not sure, yup, it's building from scratch so it's going to take some time again. But these things happen when you develop your big applications. So, this is kind of a big project. We have Firebase, we have One Signal, we have some social media features, push notification features. So, it's common for us to wait for this to be built up occasionally. Okay. So, after this is done, you're going to be displayed with this push notification permission one more time and I am going to allow this. Okay. And let's see if we get the subscribed user right now. So, let me go back to my One Signal dashboard. And what we want to do is to refresh the page to see if subscribed users is one right now. So, here you go. Now, it's subscribed and it's working. So, now I can receive push notifications in my actual iPhone. So, here you will see a send a push message, Common Actions. So, it's under common actions. So, if you cannot see it, you can find it from the menu as well. As you can see, there, there is a messages menu over here and you can come over to that message and you can just say new push in order to create a push from dashboard. So, this is where you can send a push message to all of your users manually. By manually, I mean you get to write the title, you get to write the message and everything and by automatic, I mean, sending it inside of Xcode. So, you can send it to all subscribed users and I'm going to give some test titles over here. Okay. And we will see how it will look like on our phone on the right hand side. For example, I can just write my first push in my title and let's write something in the subtitle like a test like my INSTACLONE. Okay. And in the message body, I'm going to just say test, test, test, test and here you go. Now, we see how this will look like and you will see some other options over here. So, for example, badge count. So, what is a badge count? So, this indicates how many notifications you have. So, let me show you some badge count representation. So, like this, the seven is the badge count of my email application. Okay. So, I have Unread seven notifications. So, if you increase it by one, it will display one in our app. Later on, you will see a sound option here. So, if you want to give a sound file to push notifications which is not very suggested, which is not very encouraged by Apple but you can use it if you want. And in here, you can provide media like a URL or an image to be displayed in the push notifications and under here, you can schedule your push notifications as well. You can just send them at a particular time if you want or you can just send them immediately. Now I'm going to confirm this and I'm going to send this message. As you can see, we have only one recipient in this case and once I send that, let me open my phone, and you will see we have this push notifications. Here we go. My first push, my Instaclone and we have this test, test, test. Now if I hit on that push notification, it will just take me to our app. So, let me open this with face recognition and let me try to click on that and here you go. Now we are inside of our app. So, this is very cool. Now we have seen how to send notifications and how to receive them. And over here in the messages section, you can actually track the statistics of your push notifications as well. For example, if you're working with a really big application, you can just send the message and under delivery tab, you can just see the statistics and in the users tab, you can see all the users. As you can see, you can actually categorize or segmentify the user as you want. For example, you can have a gender segmentation or you can have an active or non active segmentation. You can just try to come up with other segmentations as well and you can just send some push notifications to only one segment at one time. So, it's kind of a CRM tool for you, Customer Relationship Management tool for you as well. And in the all users tab, you will see all subscribed users. For example, this is our current phone and we have this player ID. So, this is a unique ID that is specific to our subscribed users and we're going to use that player ID in order to send push notifications to a specific user later on. So, we're going to stop here and within the next lecture, we're going to deep dive into this player ID thing.
Atil is an instructor at Bogazici University, where he graduated back in 2010. He is also co-founder of Academy Club, which provides training, and Pera Games, which operates in the mobile gaming industry.