Show TOC

Creating a Project and Importing the OData Libraries and BundlesLocate this document in the navigation structure

Set up the iOS development environment by downloading the required plugins and importing the associated iOS libraries into the iOS development environment.

Prerequisites

Install the OData SDK on the Mac development machine.

Context

Procedure

  1. Start Xcode and select Create a new Xcode project.
  2. Under iOS, select Application.
  3. In the right pane, select Empty Application as the project template and click Next.
  4. Set Project Options, then choose Next.
  5. Configure library dependecies either by using a .podspec file, or by copying includes and libraries:
    Option Description
    Configuring dependencies using a .podspec file
    1. Copy the NativeMAF.podspec file installed with the iOS SAP Mobile Platform SDK into the /NativeSDK/MAFReuse/iOS/ directory of your SAP Mobile Platform SDK installation.
    2. Create a new iOS project in Xcode then close Xcode.
    3. Navigate to the project directory in Terminal, and run pod init.
    4. Copy this text into the generated Podfile to import all libraries:
      ################################## 
      platform :ios, "8.0" 
      target "<My Project Name>" do 
      inhibit_all_warnings! 
      pod 'NativeMAF', :path => "~/SAP/MobileSDK3/NativeSDK/MAFReuse/iOS/"  
      end 
      ################################## 
      
      Tip If you do not want to import all libraries, you can use subspecs for some libraries. To do so, copy the NativeSDK.podspec file installed with the iOS SAP Mobile Platform SDK into the /NativeSDK/ directory of your SAP Mobile Platform SDK installation.

      For example to use only the ODataOnline library, copy this text into the Podfile:

      ################################## 
      platform :ios, "8.0" 
      target "<My Project Name>" do 
      inhibit_all_warnings! 
      pod 'NativeSDK/ODataOnline', :path => "~/SAP/MobileSDK3/NativeSDK/"  
      end 
      ##################################
      
      The following subspecs are supported:
      • NativeSDK/ODataOnline
      • NativeSDK/MAFLogon
      • NativeSDK/ODataOffline
      • NativeSDK/Usage
      • NativeSDK/HttpConversationManager
      • NativeMAF/ODataAPI
    5. Modify the path to match the location of /NativeSDK on your machine.
      Note If you are referencing NativeSDK headers in the project *.pch file, you must also add pod 'NativeSDK' to the Tests target.
    6. Run pod install.
    7. Open the .xcworkspace file, instead of the .xcodeproj file. The workspace is now your regular working area.
    Note This version of the SDK supports pod version 0.35.0 and earlier.

    Configuring dependencies by copying includes and libraries

    1. Select a location to save the project and click Create to open it.
    2. Navigate to the <SMP_HOME>\MobileSDK<vesrion>\NativeSDK\ODataFramework\iOS\ installation directory.
    3. Copy includes and libraries of components you would like to add to your project.Select your project from the Project Navigator, and choose your application's target.
    4. Open the Build Phases tab, and within Link Binary with Libraries, add all necessary native frameworks.
    5. Choose your project, rather than a specific target, and open the Build Settings tab:
      1. In the Other Linker Flags section, add -ObjC and -all_load. If these settings are not visible, change the filter in the Build Settings bar from Basic to All.
      2. In the header search path section adjust the path to look for public header files. Depending on where you copied the header files in previous steps, the path string looks like this: $(PROJECT_DIR)/includes/public/**
      3. In the library search path section adjust the path to look for the binary files. Depending on where you copied the library files in previous steps, the path string looks like this: $(PROJECT_DIR)/libraries/$(BUILD_STYLE)-universal/*
  6. Build and run your project.