Mobile SDK Upgrade From 2.3 to 3.0

May 23, 2015

Compilation and Linking Issues

Upgrading Salesforce Mobile SDK from 3.1 to 3.2 is indeed quite simple

$ cd <your_Cordova_app_folder>
$ cordova plugin rm com.salesforce
$ cordova prepare

But every time I did the upgrade from 3.x to latest version of SDK. I see the following set of errors.

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_SFHybridViewController", referenced from:
      objc-class-ref in AppDelegate+SalesforceHybridSDK.o
  "_OBJC_CLASS_$_SFDefaultUserManagementViewController", referenced from:
      objc-class-ref in AppDelegate+SalesforceHybridSDK.o
  "_OBJC_CLASS_$_SFUserAccountManager", referenced from:
      objc-class-ref in AppDelegate+SalesforceHybridSDK.o
  "_OBJC_CLASS_$_SFLogger", referenced from:
      objc-class-ref in AppDelegate+SalesforceHybridSDK.o
  "_OBJC_CLASS_$_SalesforceSDKManager", referenced from:
      objc-class-ref in AppDelegate+SalesforceHybridSDK.o
  "_OBJC_CLASS_$_SFLocalhostSubstitutionCache", referenced from:
      objc-class-ref in AppDelegate+SalesforceHybridSDK.o
  "_OBJC_CLASS_$_SFPushNotificationManager", referenced from:
      objc-class-ref in AppDelegate+SalesforceHybridSDK.o
  "_OBJC_CLASS_$_SFHybridViewConfig", referenced from:
      objc-class-ref in AppDelegate+SalesforceHybridSDK.o
ld: symbol(s) not found for architecture arm64

And you see the following binaries (.a) files are missing.


Under "Compile Sources" InitialViewController.m was missing.


Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_InitialViewController", referenced from:
      objc-class-ref in AppDelegate+SalesforceHybridSDK.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)



Also, please note that there used to be two modules for networking.

libMKNetworkKit-iOS.a
libSalesforceNetworkSDK.a

Now, libSalesforceNetwork.a replace them both.

Resolution

I started off by linking the missed libraries manually.

Link the binaries under "$(SRCROOT)/OneStop/Plugins/com.salesforce"  in Build Phases.  Also, don't forget to add InitialViewController.m under compile sources.
I also added CDVDevice.m to resolve the plugin error.

IT Worked!!

Soon, I faced a roadblock. Once I authorize the app, the screen is stuck at "Loading" view. "Create Passcode" screen never comes up in iOS 8.3 OR intermittently comes up in  older version of iOS 8.

I thought there should be a fix in unstable branch. I downloaded the source code of iOS SDK (https://github.com/forcedotcom/SalesforceMobileSDK-iOS) and generated libraries by running SalesforceSDKCore and SalesforceSDKCommon projects in "Release" mode. In order to run in release mode, I edited the scheme to select "Release" mode for Build Configuration.



Once done, pickup files from "Release-iphoneos" folder. You can navigate to the folder by looking up for the .a file under "Products" folder in Xcode.




I copied all the files to $(SRCROOT)/OneStop/Plugins/com.salesforce and linked them again. This time I made sure names and link order match with the sample apps.

It worked!


If you want to do this in a simple way, just navigate to com.salesforce plugin repo (https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin) and copy the libraries. The task of importance is to make sure you have correct libs and right linking order.

You Might Also Like

0 comments

Popular Posts

Twitter