function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jorge2Jorge2 

Existing project with ARC?

I'm somewhat new to iOS development and have a start-up question: is it possible to use the Salesforce SDK with an existing project that has ARC enabled? If so, how?

Thank you

Best Answer chosen by Admin (Salesforce Developers) 
Jorge2Jorge2

I was finally able to get things working by building according to the instructions, and adding SDK files to an existing project. I also needed to add git to my path; it's installed by XCode but wasn't found by the build script ("install.sh").

 

Thanks for the help and suggestions

All Answers

jhersh1jhersh1

Add the SDK files as normal to your project, then just set those files' compiler flags to not use ARC: -fobj-no-arc

Jorge2Jorge2

Thanks @jhersh1 - do I still need to build the SDK (run "./intsall.sh") and install the Salesforce project templates, or could I copy the ".a" file and headers from one of the sample apps?

Kevin HawkinsKevin Hawkins

If you're including the Salesforce SDK with an existing project, you don't need to use a template.  The SalesforceSDK binaries are in the dist/SalesforceSDK/ folder, so you can just unzip the debug or release archive, as desired, and include the package in your project.

 

Given that libSalesforceSDK.a is a static library, you don't need to do anything special to use it in your ARC project; it should "just work".  However, you'll likely need to include the other dependencies of libSalesforceSDK as well--SalesforceCommonUtils, SalesforceOAuth, and RestKit.  These are all available under the dist/ folder as well.

Jorge2Jorge2

Kevin - thank you very much for the complete & clear answer. Let me try that and I'll come back to mark the solution.

Jorge2Jorge2

Unfortunately, it didn't work for me yet... I included the ".a" files in my project, but get lots of errors like: "Undefined symbols for architecture i386..."

 

I don't understand these errors - a Google search points me to lots of posts on Stackoverflow.com, and I tried to follow the various solutions offered there, but without success.

 

Any ideas?

 

Thanks

Jorge2Jorge2

I was finally able to get things working by building according to the instructions, and adding SDK files to an existing project. I also needed to add git to my path; it's installed by XCode but wasn't found by the build script ("install.sh").

 

Thanks for the help and suggestions

This was selected as the best answer