Skip to Content

Create a Sample iOS App

test
0 %
Create a Sample iOS App
Details
// Explore More Tutorials

Create a Sample iOS App

04/23/2019

Create and examine your first Fiori for iOS app using the SAP Cloud Platform SDK for iOS Assistant connecting against a sample service.

You will learn

  • How to create a Fiori for iOS application
  • What the SAP Cloud Platform SDK for iOS Assistant can generate.


Step 1: Run the SAP Cloud Platform SDK for iOS Assistant

This app will be the foundation for most of the iOS tutorials on the Tutorial Navigator

Double-click the SAP Cloud Platform SDK for iOS Assistant icon to start the application. If no applications have been generated previously, you will see the initial screen:

SDK Assistant
Log on to answer question
Step 2: Create a new cloud application

For this tutorial, you will create a new cloud application configuration in Mobile Services, which will be configured to access data of the sample service.

Click the Create new button in the First Steps section. The first step of the workflow asks you to choose whether to create a sample app, use an existing cloud app configuration, or create a new one.

Project Properties

Click the Create new Application tile on the right side of the Create a new App step. This will allow us to create both a server-side configuration for the app, and it will generate a new Xcode project for an iOS app.

Next select your SAP Cloud Platform Mobile Services account and click Next.
Project Properties

In the Add an SAP Cloud Platform Mobile Services application step, add the needed application details to create an application in your mobile services account.

Enter the following details:

Field Value
Application Name MyProductApp
Identifier com.example.product
Authentication OAuth2
Project Properties

Note: The name of the cloud application does not need to match your iOS app name, and often won’t; your iOS app may access multiple cloud applications. The Application Identifier, however, must be unique across all of your configured cloud applications, and typically follows a reverse-DNS format.

Click Next to advance to the Destinations step.

Log on to answer question
Step 3: Add the sample service as an destination endpoint

In the Destinations step, you can define the backend connection. You will select the com.sap.edm.sampleservice.v2 destination as a backend endpoint.

Destinations

Click Next to advance to the Features step.

Log on to answer question
Step 4: Enable features

In the Optional Features step, you have the option to enable logging and log uploads, enable remote notifications, use Discovery Service and whether to use Online or Offline OData.

Features

Make sure the checkboxes Enable Log Upload, Enable Remote Notifications and Use Discovery Service for Application bootstrapping are selected, and the OData Provider radio button is set to Enable Online OData and click Next to proceed to the Xcode Project step.

Log on to answer question
Step 5: Set up the Xcode Project

In the Xcode Project configuration step you will set up your actual Xcode project for development later on.
Enter the following details:

Field Value
Product Name MyProductApp
Organization Name <your company name>
Organization Identifier com.sap.mobile.example
Path <choose a local destination>
Project Properties

Click Next to advance to the Proxy Classes step. Here you can see what destination is going to be used to pull the Metadata of the OData Service to generate the OData Proxy Classes.

Project Properties

Click Next to go to the UI Configuration step. Set the Destination radio button to Master / Detail View with Onboarding for destination: and click finish.

Project Properties
Log on to answer question
Step 6: Generate the Xcode project

After you have clicked Finish in the previous step, the SDK Assistant now loads the OData service’s metadata. This metadata describes the data model, and can be accessed via <service URL>$metadata. For the sample service, the metadata URL is https://hcmps-<your_user_id>trial/hanatrial/ondemand.com/mobileservices/origin/hcpms/ESPM.svc/v2/$metadata
Based on this metadata, the OData proxy classes will be generated for the Xcode project.

In addition, the configuration settings you have provided in the SDK Assistant are now being sent to SAP Cloud Platform Mobile Services.

Note: If you have already 5 native applications defined in SAP Cloud Platform Mobile Services, the SDK Assistant will give you an error.

In that case, log on to your SAP Cloud Platform mobile Services account at https://hcpmsadmin-<your_user_id>trial.dispatcher.hanatrial.ondemand.com/ and navigate to Mobile Applications > Native/Hybrid. Select one of the available application configurations and delete it in order for the SDK Assistant to add the new application configuration.

Log on to answer question
Step 7: Examine the generated Xcode project

You can now select the MyProductApp application project under Recent Projects in the SDK Assistant’s starting screen.

If Xcode does not open automatically to show your project, click on the project name in the SDK Assistant and click Open.

In Xcode, the left-hand sidebar of the window shows various Navigators for exploring your project, source control, debugging, and so on. If it’s not already selected, select the Project Navigator by clicking on the folder icon above the left-hand sidebar. This shows all of the files in the project.

Xcode project overview

The Main.storyboard file shows a split-view setup for the generated Master-Detail views.

The MyProductApp/Onboarding folder contains logic for the user onboarding, authentication and handling of passcodes and Touch ID.

The MyProductApp/Proxy Classes folder contains the OData proxy classes generated from the OData service. The ESPMContainer.swift file in the Proxy Classes/public folder acts as a data service provider to gain access to the OData entities. The ESPMContainerMetadata represents the metadata definition of the service.

The ViewControllers folders contain the master and detail view controllers as well as a storyboard for the entities, respectively.

What does the SAP Cloud Platform SDK for iOS Assistant generate for you? Check all that apply.
×

Next Steps

Prerequisites

Back to top