Skip to content

iOS - Upgrading from version 1.x to 2.x

We have updated our plugin to follow the changes made in iOS. Apple deprecated UILocalNotification in favor of UNUserNotificationCenter. Plot Projects no longer makes use of the UILocalNotification.

A change of behaviour in the library is that notifications are now shown to the user when the app is already in the foreground. In version 1.x the notification would be opened straight away without showing it to the user.

Changes to Project settings

Our library now also depends on the UserNotifications.framework, provided by iOS. When using CocoaPods, this dependency is automatically added, so no extra steps are required. Otherwise, you have to add this dependency yourself in the Build Phases screen.

The minimum supported iOS of 2.x is iOS 10. When you want to target iOS 11 features, it is required to make use of this version of our library.

Ensure that all permission description info keys are defined. You can set those in your XCode project settings. You can find them in at the "Custom iOS Target Properties" under the "Info" tab of your build target. The required for iOS 10 and iOS 11 are:

Required Key Description shown in XCode
NSLocationAlwaysUsageDescription Privacy - Location Always Usage Description
NSLocationWhenInUsageUsageDescription Privacy - Location When In Usage Usage Description
NSLocationAlwaysAndWhenInUsageUsageDescription* Privacy - Location Always And When In Usage Usage Description

* this key is added in XCode 9. If you're using XCode 8, you can add the key yourself.

Changes to the AppDelegate

You must still call the initializeWithLaunchOptions: method of the Plot library in the didFinishLaunchingWithOptions method. When your app has its own NotificationCenterDelegate, you must register that one before initializing the Plot Projects plugin.

The method didReceiveLocalNotification: and the corresponding call to [Plot handleNotification:] is no longer required and should be removed.

Changes to Plot classes and the PlotDelegate

You can find the methods for the notification filter, notification handler and geotrigger handler in the PlotDelegate protocol.

The method names in the Plot class and the PlotDelegate stayed the same, but the return types and function parameters have changed from UILocalNotification to UNNotificationRequest. Refer to the reference documentation for the exact method signature. The keys/values in the userInfo fields of notifications and geotriggers remained unchanged.