[SDK] [iOS] Release v1.2.0.0

GitHub release
Integration guide

Changelog:

  • Distribute as a cocoa pod
  • Easier AppDelegate integration
  • Renamed manual AppDelegate integration method names
  • Permit auto dropping/opening a notification received in foreground
  • Do not simulate system alert for data notifications received in foreground
  • Report device country and currency
  • Handle updateInstallation button action
  • Handle "at notification click" actions
  • Do not simulate system alert for data notifications received in foreground
  • Report aps-environment entitlement to distinguish development from production
  • Regroup individual app open/close into sessions, like on the other platforms
  • Improve notification reception reporting using the remote-notification background execution mode
  • Fix from notification and influenced app open reporting
  • Fix notification reaction event reporting
  • Miscellaneous fixes

Upgrading

There are 3 new points that requires your attention:

  • We now use CocoaPods to ease the installation of the WonderPush SDK.
  • The integration is also facilitated in your AppDelegate, you won't have to implement methods just to call the WonderPushSDK.
  • You should add the remote-notification background execution mode for better statistics tracking.

I don't use CocoaPods yet

Don't worry it's easy. Install it using the following command:

sudo gem install cocoapods

You can read the complete installation guide here, but you normally won't need it.
(In some cases it can take 1-2 minutes before showing anything on the screen, just be patient, it's working real hard...)

Once CocoaPods is installed, you'll have to create a Podfile for your project.
You can give a try to the specially purposed command:

pod init

Or you can edit the Podfile file yourself so that it reads the following:

platform :ios, "7.0"

Then simply run:

pod install

This will edit your project to create a multi-project workspace so that each dependency builds as their respective developer planned them to build.

Finally, you will need to close your project in XCode, and open instead the newly created YourProject.xcworkspace file, as indicated in the command output.

You can continue with the next section.

Adding the WonderPush SDK as a CocoaPods dependency

Edit your Podfile to add the following line:

pod 'WonderPush', '~> 2.0'

Next run the following command to effectively download and incorporate WonderPush to your project:

pod install

You are now set to use the latest 1.2.x.x version. (You'll note that we dropped the v1 prefix, that denotes the API version to conform to semantic versioning.)
To perform a version update when a new one becomes available, you would simply run pod update.

AppDelegate changes

We now offer delegate chaining to permit the SDK to implement all the necessary methods without requiring you to do anything.
To use this technique, replace every call to made to WonderPush from your AppDelegate by the following code:

- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [WonderPush setClientId:@"YOUR_CLIENT_ID" secret:@"YOUR_CLIENT_SECRET"];
    [WonderPush setupDelegateForApplication:application];
    return YES;
}

The key here is the +[WonderPush setupDelegateForApplication:] method call.

We placed it in the application:willFinishLaunchingWithOptions: method because this way the application:didFinishLaunchingWithOptions: can be properly intercepted.
Should you need to setup the delegate in the latter for any reason, make sure in addition to call the same-named method of the SDK yourself.

If you do not wish to use this automatic setup, you will have to implement each method of the UIApplicationDelegate protocol that have their matching function in the WonderPush SDK, and call the SDK in each of them.

The use of the automatic delegate setup does not prevent your implementations of the same-named methods from being called.
In fact our delegate makes sure that every message it receives is passed on to your delegate, whether it intercepted it for its own needs or not.

One caveat you may need to know: Our delegate implements the application:didReceiveRemoteNotification:fetchCompletionHandler: method, this means that the application:didReceiveRemoteNotification: of your delegate will no longer be called. You are asked to use the former instead. Here is the official documentation.

remote-notification background execution mode

This permits your app to receive silent or data-only notifications, as well as better report influenced application opens, by measuring the time between the reception of the notification and the following application open.
Although not mandatory, you are highly encouraged to add it to your app.

To add the remote-notification background execution mode, select your project in the Project navigator on the left, go to the Capabilities tab, switch Background Modes on, and check Remote notifications.
Here is the official guide to enabling background modes, and official documentation to the remote-notification background mode.