Monthly Archives: September 2015

Tips for Upgrading Mobile SDK Apps for iOS 9

iOS 9 is here, and we’ve got a couple of tips for how to update your Mobile SDK apps.

If at all possible, you should update your app to Mobile SDK 3.3.1 (or later), and then apply the fix in Tip #1. If you’re unable to update at this time, you should implement both Tip #1 and Tip #2.

Tip #1

In iOS 9, Apple introduces an Application Transport Security feature for secure network connections. See https://developer.apple.com/library/ios/technotes/App-Transport-Security-Technote/ for a list of their requirements.

Salesforce servers use TLS 1.2 but do not yet support forward secrecy. Until they do, Mobile SDK apps need to disable the forward secrecy requirement. If you created your app with Mobile SDK 3.3.1 or later, you don’t need to change anything. If your app is based on Mobile SDK templates from a version earlier than 3.3.1, add the following configuration to your application plist:

<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>salesforce.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>force.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>

To see these how we made these changes for Mobile SDK 3.3.1, check out https://github.com/forcedotcom/SalesforceMobileSDK-iOS/pull/1170.

Tip #2

iOS 9 introduces subtle behavior changes in the unarchiveObjectWithFile: method of NSKeyedUnarchiver. Due to these changes, users automatically get logged out after restarting any iOS Mobile SDK app built with Mobile SDK 3.3 or earlier. We’ve fixed this issue in the Mobile SDK 3.3.1 release. We urge all iOS developers to update to Mobile SDK 3.3.1 (or later). Otherwise, your application won’t behave properly on iOS 9 devices.

If for some reason you can’t upgrade to 3.3.1 (or later) at this time, you’ll need to edit the SDK source code and rebuild the SDK. Here are the details for manually addressing this issue:

The unarchiveObjectWithFile: message of the NSKeyedUnarchiver class now returns nil upon failure, instead of throwing an exception. You’ll need to update SFUserAccountManager.m manually as shown here:
https://github.com/forcedotcom/SalesforceMobileSDK-iOS/pull/1123/files

After making the change, rebuild the Mobile SDK libraries and then use them to rebuild your app.

Advertisements