Category Archives: Mobile SDK Patch Releases

Errors Creating Hybrid Apps in Mobile SDK 4.3

If you’re upgrading to Mobile SDK 4.3.x and plan to build hybrid apps, heed this tip!

Under certain conditions, the Cordova telemetry feature can cause forcedroid or forceios to fail with bewildering error messages. So far, we’ve seen this problem occur when:

  • You’ve installed the latest version of Cordova (6.2.0 or higher)
  • You’re using forcedroid or forceios to create a hybrid app

If both of the above are true, the script might throw an error such as the following:

“”. Should be in the format x[.y[.ignored]]

) is less than the minimum required version (5.4.0). Please update your version of Cordova.”

These errors occur if you haven’t preset telemetry to some value. Even if you don’t get weird error messages, you’ll still eventually get this prompt asking you to set the telemetry attribute:

May Cordova anonymously report usage statistics to improve the tool over time?

To avoid these hiccups, preset telemetry on or off before you run the script. Just type:

cordova telemetry <on|off>

Afterwards, forcedroid or forceios should work as expected.

For more information, type:

cordova telemetry -h
Advertisements

Mobile SDK 4.0.2 Is Now Available

 

Following close on the heels of our 4.0 major release and 4.0.1 patch, the 4.0.2 patch for Mobile SDK (Android and iOS) is now available. This patch primarily affects CocoaPods podspecs for iOS developers. We’ve also republished both forceios and forcedroid to keep them on the same version. See the section below for more details on what’s new.

To upgrade:

  1. Uninstall and reinstall forceios and forcedroid from npm.
  2. On iOS, rework your podspecs as described in the following section.
  3. If you use the GitHub repos, merge these tags:
    Android: https://github.com/forcedotcom/SalesforceMobileSDK-Android/tree/v4.0.2
    iOS: https://github.com/forcedotcom/SalesforceMobileSDK-iOS/tree/v4.0.2

CocoaPods Reorganization

In Mobile SDK for iOS 4.0.1, our podspec configuration didn’t exert enough control over external dependency versions. For 4.0.2, we’ve now removed the SalesforceMobileSDK-iOS podspec and replaced it with a separate podspec for each Mobile SDK module. We’ve also added a new GitHub repo, https://github/forcedotcom/SalesforceMobileSDK-iOS-Specs, that serves as the archive for all versions of our podspecs.

The new podspecs are:

SalesforceSDKCore—Implements OAuth and passcodes. All other pods except FMDB depend on this pod, either directly or indirectly.
SalesforceNetwork—Networking library (with transparent token refresh when session expires). Depends on SalesforceSDKCore.
SalesforceRestAPI—REST API wrappers for accessing Salesforce data. Depends on SalesforceNetwork.
FMDB—The Mobile SDK fork of FMDB, a third-party Objective-C wrapper for SQLite. This fork implements customized logging and
imports SQLCipher with full-text search support.
SmartStore—Implements secure offline storage. Depends on FMDB and SalesforceSDKCore.
SmartSync—Implements offline synchronization. Depends on SalesforceRestAPI and SmartStore.
SalesforceReact—Implements Salesforce Mobile SDK React Native bridges for apps written with React JavaScript and markup. Depends on SmartSync.

Here’s how to update your Podfile for the 4.0.2 patch.

1. In your project’s Podfile, add the SalesforceMobileSDK-iOS-Specs repo as a source before adding the CocoaPods source.

target 'YourAppName' do
# must get SalesforceMobileSDK-iOS-Specs 
# source first (before CocoaPods)! 
source 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Specs.git' 
source 'https://github.com/CocoaPods/Specs.git'

2. Declare each pod on a separate line.

pod 'SalesforceSDKCore'
pod 'SalesforceNetwork'
pod 'SalesforceRestAPI'

Or, thanks to dependency chains, this will work if you’re using the current release:

pod 'SalesforceRestAPI'

If you currently have a podspec that calls pod SalesforceMobileSDK-iOS with subspecs for Mobile SDK modules, such as:

pod 'SalesforceMobileSDK-iOS', :subspecs =>[ 'SalesforceRestAPI' ]

Replace this call with individual pod calls, as shown above.

Working with an Unstable Branch

To work with an upcoming release of Mobile SDK, you clone the unstable branch of the SalesforceMobileSDK-iOS repo, and then pull resources from it.

  1. Clone github.com/forcedotcom/SalesforceMobileSDK-iOS locally at the desired commit.
  2. At the terminal window, run ./install.sh in the root directory of your clone.
  3. To each pod call in your Podfile, add a :path parameter that points to your clone. Note that you shouldn’t skip dependencies if you’re specifying a path—you need to call the pod command individually for each module.

Here’s the previous example repurposed to pull resources from a local clone:

target 'YourAppName' do
# must get SalesforceMobileSDK-iOS-Specs 
# source first (before CocoaPods)! 
source 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Specs.git' 
source 'https://github.com/CocoaPods/Specs.git' 

pod 'SalesforceSDKCore', :path => 
    '/<path-to-clone-of>/SalesforceMobileSDK-iOS/' 
pod 'SalesforceNetwork', :path => 
    '/<path-to-clone-of>/SalesforceMobileSDK-iOS/' 
pod 'SalesforceRestAPI', :path => 
    '/<path-to-clone-of>/SalesforceMobileSDK-iOS/' 

end

For more information, see the Salesforce Mobile SDK Development Guide at https://github.com/forcedotcom/SalesforceMobileSDK-Shared/blob/master/doc/mobile_sdk.pdf?raw=true.