2

I have a stable project on iOS, with Objetive C. I use cocoapods.

This is my podFile:

“
platform :ios, 7.0
pod 'RestKit', '~> 0.20.0rc'
pod 'FMDB'
# pod 'FMDB/FTS'                # FMDB with FTS
# pod 'FMDB/standalone'         # FMDB with latest SQLite amalgamation source
# pod 'FMDB/standalone/FTS'     # FMDB with latest SQLite amalgamation source and FTS
pod 'FMDB/SQLCipher'            # FMDB with SQLCipher
pod 'CocoaLumberjack'           #Fichero de log dentro de la app   https://github.com/CocoaLumberjack/CocoaLumberjack
pod 'mailcore2-ios'                #Enviar ficheros de log por correo
pod 'TesseractOCRiOS', '4.0.0'    #OCR 
“

I can install Salesforce SDK with pods, without any problem:

“
target 'andromedaTecnico' do

    source 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Specs.git' # need to be first
    source 'https://github.com/CocoaPods/Specs.git'

    use_frameworks!
    pod 'SalesforceSDKCore'
    pod 'SalesforceNetwork'
    pod 'SalesforceRestAPI'
    pod 'SmartStore'
    pod 'SmartSync'


end
pod 'mailcore2-ios'                #Enviar ficheros de log por correo
pod 'TesseractOCRiOS', '4.0.0'    #OCR
“

But, when I try to use a class, SalesforceSDKManager by example, I obtain some errors.

I followed this articles: https://developer.salesforce.com/docs/atlas.en-us.mobile_sdk.meta/mobile_sdk/ios_cocoapods.htm

Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_SalesforceSDKManager”

I tried a lot of things, configurations, … and always I have new and different errors.

Have I forgotten any step?

Thanks a lot.

PD: I use El Capitan, Xcode 7, Objetive C and I can´t change to Swift.

3

I've done this a few times - added the Salesforce iOS SDK to my existing apps. There's actually a tutorial which my good friend Quinton Wall wrote for this. The key steps which you may be missing are

  • Adding a Bridging Header
  • Configuring your AppDelegate

Once these are done, you also need to ensure (quoting from the tutorial)

Then, to handle to end of the authentication flow, specify that your View Controller is a delegate for the MobileSDK:

class MyViewController: UIViewController, SFAuthenticationManagerDelegate
and implement the Delegate's authManagerDidFinish function. 

I typically check if the username has been populated correctly. If it has, only then do I perform the segue to my HomeController.

The SFAuthenticationManagerDelegate does include a didAuthenticate function which is technically the correct place to perform a check for successful login, however I have found that this method gets called prior to the SDK performing a remove view for the Salesforce login screen. The result is that our newly displayed Home ViewController is removed. :( Within the viewDidLoad method, register this controller as a delegate.

SFAuthenticationManager.sharedManager().addDelegate(self)

func authManagerDidFinish(manager: SFAuthenticationManager!, info: SFOAuthInfo!) {

 if !!SFAuthenticationManager.sharedManager().haveValidSession {
     //call the segue with the name you give it in the storyboard editor
     self.performSegueWithIdentifier("loggedIn", sender: nil)

     //or simply dismiss the login view to return to where you came from
     // self.dismissViewControllerAnimated(true, completion: {})
    }
}

This should fix it!

1
  • Hello Gaurav Kheterpal I tried the tutorial from Quinton Wall without success. I write Quinton by Twitter to get help. Now, I import SDK with pod and another libraries, but I can´t use FMDB outside SmartStore. salesforce.stackexchange.com/questions/124465/… Thanks.
    – CesarRN
    Jun 2 '16 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.