Setting Up the iOS Development Environment¶
iOS Environment Requirements¶
Complete the prerequisites for developing a device application for the iOS platform, and set up the development environment.
Downloading the Xcode IDE¶
Download and install Xcode from the AppStore, or from the Apple Developers Web site, as described here:
Log in using your Apple Developer credentials.
(Optional) To narrow the search scope, unselect all Categories except Developer Tools.
Download the appropriate Xcode and SDK combination.
Note: See supported Apple iOS requirements at https://support.sap.com/release-upgrade-maintenance/pam.html
Downloading the SDK and Creating a Project and Importing the OData Libraries and Bundles¶
Retrieve the Native SDK zip file and set up the iOS development environment by downloading the required plugins and importing the associated iOS libraries into the iOS development environment.
Retrieve the SMPNativeSDK-3.1.x.x.zip (the latest one) from Software Downloads
- Under Installations & Upgrades, select Access downloads.
- Expand By Alphabetical Index (A-Z), select M, then select SAP MOBILE PLATFORM SDK 3.1.
- Select SAP NATIVE SDK3.1.
- Extract the contents of the .zip file to a temporary directory on a local disk on the target host.
Start Xcode and select Create a new Xcode project. Under iOS, select Single View App.
In the next pane, enter Product Name and set language to Objective-C and click Next.
Select the temporary directory where you extracted the zip file to and navigate to the Tools directory, then the osx folder, copy the ilodata file to the Tools directory under C:\SAP\MobileSDK3.
Navigate back to iOS directory (the temporary directory where you extracted the zip file to) and copy the libraries and includes folders to your Xcode project folder. Open the Build Phases tab, and within Link Binary with Libraries, add all necessary native frameworks.
- Choose your project, rather than a specific target, and open the Build Settings tab:
- 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.
- Open the Build Phases tab, and within Link Binary with Libraries, add all necessary native frameworks.
- 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/**
- 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/*
Build and run your project.
Setting Up the iOS Development Environment That Uses Maven¶
Set up your development environment that uses a Maven repository.
Run the deploy.sh script and deploy the artifacts:
- After installing SAP Mobile Platform SDK, the deploy.sh script file appears under the iOS folder.
Deploy the libraries to the local Maven repository of the application developer by opening a terminal and running
$ ./deploy.sh - executing the script without an argument deploys all artifacts to the ~/.m2/repository default location.
$ ./deploy.sh ~/m2/localRepository - uses the parameter as the location of the local repository.
After running the script, all artifacts are deployed into the local Maven repository under the
Use the deployed artifacts with the Maven infrastructure. When you create an Xcode project or use an existing one with Maven, you must create a pom.xml file and manually add it to the project:
a. Add the following section to the dependency tag to import the Maven artifacts to the target folder of the project:
- For the Odata libraries add:
<dependency> <groupId>com.sap.smp.client.iosdemo</groupId> <artifactId>ODataSDK</artifactId> <version>3.X.X</version> <type>pom</type> </dependency>
- For the MAF libraries add:
<dependency> <groupId>com.sap.smp.client.iosdemo</groupId> <artifactId>MAFSDK</artifactId> <version>3.X.X</version> <type>pom</type> </dependency>
Note: To be able to build the project with Maven, the SAP Maven iOS plug-in must be added. See http://sap-production.github.io/xcode-maven-plugin/site/ for more information.
<build> <plugins> <plugin> <groupId>com.sap.prd.mobile.ios.mios</groupId> <artifactId>xcode-maven-plugin</artifactId> <version>1.14.1</version> <extensions>true</extensions> </plugin> </plugins> </build>
b. After the
pom.xml is created, run mvn initialize.
All artifacts are copied under the
target folder after initialization.
c. Open the project and open Build Settings. Search for the Library search path and Header search path settings.
$(PROJECT_DIR)/../../target/headers/$(BUILD_STYLE)-$(PLATFORM_NAME)to the header search path.
$(PROJECT_DIR)/../../target/libs/$(BUILD_STYLE)-$(PLATFORM_NAME)to the library search path.
3.. Open the Build Phases and open the Link Binary With Libraries and with e + icon, and add the necessary libraries to your project.