Thursday, October 23, 2014

Notification API changes in iOS 8 – Part 1

There are several changes need to be done when updating your iOS 7 app to iOS 8. If your app uses notification have come to write place J.

Previously iOS 7 has User Notifications and Silent Notifications. User notifications are the things that the user can interact with see or hear under device. They are coming directly form the app or from APNS server. In iOS 7 when we get a notification we could do the following.

1. Badge the app icon
2. Play a sound
3. Alerts tip down from the top of the screens.

Silent notifications are the push payloads you get from APNS server with the content-available set to 1, to do back ground task with out not disturbing the user. For example download the new content from the server, which will enable up to date update information when the user uses app in the next time.

Let’s see the changes in iOS 8 Notifications. There are basically 4 updates in iOS 8. They are

1.    User notifications - Changes in registration.
2.    Notification actions.
3.    Remote notification Changes in registration.
4.    Local notifications.
      
In this post I’m going to talk about what are changes in User notifications and Remote Notifications.

First we look at the User Notification

In iOS 8 regardless of your application going to show remote notifications or local notifications the app must first register to user those notification.


1.    Create Notification Type object.
2.    Create notification settings object with the created notification types.
3.    Call the application did register notification with settings method.
This will ask from the user by displaying an alert message that the app is going to user notification is it ok with you.
4.  Once the user have replied to the message, the app delegate will get a call back (didRegisterUserNotificationSettings). From that call back you will get up to date most current notification settings object with user preferred notification types.




Remote Notifications.

If you are using remote notification in your app first you need to register for the notification as I discussed above. Then at the didRegisterUserNotificationSettings  call back method you need to call [application registerForRemoteNotifications]. That’s it. You are done J.

Then the application delegate will get the call back to didRegisterForRemoteNotificationsWithDeviceToken or didFailToRegisterForRemoteNotificationsWithError. From that point no change its same as the previous versions.


In the next post; Notification changes in iOS 8 – Part 1, I will discuss the one of the most excited and interesting feature in iOS 8 Notification which is Location base notifications. J




Thursday, February 6, 2014

AyalBadgeView

Today I’m going to talk about a simple badge view, which can be applied, to any view. You can simply create object of "AyalBadgeView" with the parent view, which you want to display the badge number and the location of the badge number.

Let's see the how to use the "AyalBadgeView".



You can download the github project "AyalBadgeView" from this location and use it in your projects.