Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member190800
Contributor
0 Kudos

Oh snap! This is awesome.

Use CocoaPods

Those of you who know me, know that I’m a big fan of the CocoaPods tool and community for discovering new open-source components for iOS development and library/dependency management.

I’ve been pushing for broader adoption in the SAP community, and have been somewhat stiemied, due to the fact that our iOS SDK isn’t distributed via github.com, or an endpoint accessible to the command-line tools.  But, I've found that by using a local path in an application's podspec, CocoaPods will read directly from your SDK install directory, instead of trying to pull from github or a remote location.  So, I absolutely recommend you try it as part of your development workflow, since the CocoaPods tool makes dependency management a cinch, and the community is rich with open-source projects that can accelerate your projects!

Copy this NativeSDK.podspec document into the NativeSDK folder of your installation directory, add this line to your project’s Podfile:

 pod 'NativeSDK', :path => "~/SAP/MobileSDK3/NativeSDK/"

...and CocoaPods will bootstrap your SDK project (headers, libraries, bundles) from your local installation.


Ah.  Yes.

Check it out

Try it.  Now.

  1. Copy the NativeSDK.podspec file into the /NativeSDK directory in your Mobile SDK 3.0 SP05 installation.
  2. Create a new iOS project in xCode
  3. Navigate to the project directory in Terminal, and run pod init
  4. Copy this text into the generated Podfile:
    platform :ios, "7.0" 

    target "MyTestApp" do
    inhibit_all_warnings!

    pod 'NativeSDK', :path => "~/SAP/MobileSDK3/NativeSDK/"

    end

    Modify the path to match the location of /NativeSDK on your own machine.

    Note:  if you are referencing NativeSDK headers in the project *.pch file, you must add pod 'NativeSDK' to the Tests target also.

  5. Run pod install
  6. Open the .xcworkspace file, instead of the .xcodeproj file.  The workspace is now your regular working area.
  7. Profit

I’ll wait..

When you add a pod using the :path prefix, it gets added to the workspace in the Development Pods folder in the Pods xcodeproj (instead the Pods folder, with the pods downloaded remotely ).  As you can see in the bottom left of the screengrab, the headers are all correctly linked.  If you scroll down in the Native SDK folder, you’ll also see all the Mobile SDK libs in the Frameworks folder, and the bundles and storyboards in the Resources folder.

Newly created xcworkspace

For extra credit:

Add an additional pod to your project!  Check out CocoaControls.com, and pick a pod to try out.  The JASidePanels pod has 2750 stars on github, and 580 forks, so it looks like a pretty robust project.

JASidePanels page on CocoaControls.com

The pod info is in the middle of the page:  copy the pod 'JASidePanels', '~>1.3.2' text, and paste into your podfile (below pod 'NativeSDK'…).  From the command line, run pod update.  The JASidePanels pod will be added to your workspace!

To remove a pod, just delete that line from your Podfile, and run pod update.

CocoaControls.com and JASidePanels are not affiliated with SAP, and rights may be reserved by their respective owners.  Special thanks to the team at Gaslight, for this blog post.