Push Notifications in iOS 10 [Swift]

Push Notification iOS 10 Swift
Push Notification iOS 10 Swift

The new framework called “UserNotifications” is introduced with iOS 10 SDK. The UserNotifications framework (UserNotifications.framework) supports the delivery and handling of local and remote notifications.

So, Let see what we have to change to get the push notifications in iOS 10.

Read more

Push Notifications in iOS 10 [Objective-C]

Push Notification iOS10
Push Notification iOS10

The new framework called “UserNotifications” is introduced with iOS 10 SDK. The UserNotifications framework (UserNotifications.framework) supports the delivery and handling of local and remote notifications. So, Let see what we have to change to get the push notifications in iOS 10.

Steps for implement code to handle push notifications in iOS 10

Import UserNotifications.framework in your AppDelegate file

Also add UNUserNotificationCenterDelegate.

Register for push notification

Before registration check the version of iOS and then based on versions do the code. For iOS 7 code was different, fro iOS 8 & 9 code was different and again for iOS 10 code is different.

As per my opinion you have to set the deployment target to iOS 8 or iOS 9 and later. For this you can check the adoption ratio of iOS in the devices.

Define constant for version check :

Add code in your did finish launching

Handling delegate methods for UserNotifications

You will be surprise that notification displayed when application in foreground too in iOS 10. As we know that in old versions we display alert or something else which will be look like notification comes in foreground.

There are two delegate methods need to be handled :

Add Push Notifications Entitlements

Go to your project target’s Capabilities tab and add Push Notifications Entitlements.

Push Notifications Entitlements

If it’s available in your certificates then it will enable directly else configure your profile with the certificates and you can enable this capability by that.

All Done!

Happy Coding ?

I have added sample code of objective-c on github with iOS 8, 9 and 10 support of push notification.
I have also posted about Push Notifications in iOS 10 [Swift].

Steps to use Legacy Swift in Xcode 8

Xcode Swift iOS10

Xcode 8.0 is released with Swift 3 and Swift 2.3 compatibility.


If you already having a project with Swift 2.2 language support with Xcode 7.3.1 and you open the project in Xcode 8.0 then, you will be prompted for the migration assistant to do a migration pass. The assistant can also be invoked manually from the menu Edit -> Convert -> To Current Swift Syntax…

  • Use Swift 2.3 Modifies your project to enable the Use Legacy Swift build setting and provides source changes to be able to build against the new SDKs.
  • Use Swift 3 This is recommended. You will get source changes to be able to build your project using Swift 3 and take advantage of all the new features in Xcode 8.0.

If you want to work with new project and you want to work with Legacy code (Swift 2.3) or 3.0 then you can do settings from build settings as follows :

Build Settings - Swift Legacy Code
Build Settings – Swift Legacy Code

Default Setting is No (Swift 3). But if you want to do legacy code (Swift 2.3) then you have to select Yes (Swift 2.3).
Make sure you do this setting by starting of new project because many methods will change.
For Example :
Swift 3 Code
[code language=”obj-c”]
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
[/code]
Swift 2.3 Code
[code language=”obj-c”]
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
return true
}
[/code]
As per my opinion Swift 3 is recommended.
Happy Coding 🙂

App Store Improvements : Apple will start the process of evaluating apps, removing apps that no longer function as intended from September 7, 2016

App Store Improvements

We love helping customers discover innovative, useful, and exciting apps on the App Store. With more than 2 million apps available and around 100,000 new and updated apps submitted each week, there’s something for everyone. To make it easier for customers to find great apps that fit their needs, we’re implementing two suggestions from the developer community starting September 7, 2016.

Quality Apps
Quality is extremely important to us. We know that many of you work hard to build innovative apps and update your apps on the App Store with new content and features. However, there are also apps on the App Store that no longer function as intended or follow current review guidelines, and others which have not been supported with compatibility updates for a long time. We are implementing an ongoing process of evaluating apps for these issues, notifying their developers, and removing problematic and abandoned apps from the App Store.

Shorter App Names
Search is one of the most frequently used methods for customers to discover and download apps from the App Store. In hopes of influencing search results, some developers have used extremely long app names which include descriptions and terms not directly related to their app. These long names are not fully displayed on the App Store and provide no user value. App names you submit in iTunes Connect for new apps and updates will now be limited to no longer than 50 characters. You can learn more about creating effective app names, as well as icons, keywords, screenshots, and descriptions, by reading the App Store Product Page.

To make it easier for customers to find great apps that fit their needs, we want to ensure that apps available on the App Store are functional and up-to-date. We are implementing an ongoing process of evaluating apps, removing apps that no longer function as intended, don’t follow current review guidelines, or are outdated.

What to Expect

When will this process start?
We will begin the process of reviewing and removing apps from the App Store on September 7, 2016.

What types of apps will be affected?
Apps in all categories on the App Store will be evaluated to make sure they function as expected, follow current review guidelines, and are not outdated.

What will happen if an issue is found with my app?
The App Store team will contact you and ask you to make any necessary changes for your app to stay on the App Store. However, apps that crash on launch will be removed immediately from the App Store.

How long do I have to make the changes?
You will be asked to submit an update within 30 days to keep your app on the App Store. If you are unable to make the changes within this time frame, your app will be removed from the App Store until you submit an update and it is approved. Please note that apps that crash on launch will be removed immediately.

If my app is removed, will my app’s name become available for other developers to use?
No. When apps are removed from the App Store, they are not deleted from your account. Your app name will continue to be associated with your app.

If my app is removed, will current users be able to access my app?
Yes. Your app will remain fully functional for current users. They will experience no interruption to services and will still be able to buy in-app purchases. However, we recommend that you update your app as soon as possible to reinstate it on the App Store and ensure that it remains functional and engaging for new and existing customers.

What can I do to help my app be ready for future changes?
As a best practice, read the latest App Store Review Guidelines as they are published and make sure your apps follow them. We also recommend that you address any functionality issues and update your app regularly to fix bugs, offer new content, provide additional services, or make other improvements. If you are no longer updating your app, consider removing it from the App Store.

Reference From : Apple News