Developer

SAP Mobile Place Workflow

Add Mobile Place to your iOS project.

Context

You must use the iOS Native Client SDK libraries, which are available as part of the SAP Mobile Platform Client SDK Installer. Mobile Place ships in the form of separate artifacts such as:
  • statically linked libraries
  • resource bundle folders
  • public header files

Before you can use Mobile Place, you must add associated artifacts. You also need to add dependent frameworks and configure your build settings. For the rest of the procedure, we assume that you are starting a new project for iOS. If you are working with an existing project, the steps may vary.

Procedure

  1. Create a new project or open an existing one in Xcode.
  2. Add MobilePlace artifacts into your project:
    • libHttpConversation.a
    • libMobilePlace.a
    • libHttpConvAuthFlows.a
    • HttpConvAuthFlows.bundle
    • MobilePlace.bundle
    • Header files for the libraries
  3. Add artifacts that the MobilePlace library depends on:
    • libClientLog.a
    • libE2ETrace2.a
    • libSupportability.a
    • libPerformanceLib.a
    • Header files for the libraries
  4. Select your project from the Project Navigator, and choose your application's target.
  5. Open the Build Phases tab, and within Link Binary with Libraries, add these frameworks:
    • Security.framework
    • libsqlite3.dylib
  6. 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, the path string should look something 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, the path string should look something like this:
      $(PROJECT_DIR)/libraries/$(BUILD_STYLE)-universal/**
  7. MobilePlace UI is shipped with a Storyboard file. To use this storyboard file, you must have MobilePlace.bundle file imported into your Xcode project. Once that is present:
    1. Open the associated group.
    2. Drag the MobilePlace.storyboard file into a group in your project anywhere outside of the bundles group.
    3. Be sure that “Copy items into destination group’s folder (if needed)” is selected.
    This enables you to present the MobilePlace UI.
  8. Open the MobilePlace.storyboard in the Storyboard Editor of the Xcode. On the File Inspector tab of the Right Xcode pane, check the Localization section.
    • Ensure that both Base and English are selected.
    • Ensure that the type Localizable Strings is selected from the drop-down list next to English.
  9. To import the translation of the Storyboard UI definition you will need to specify all the supported localizations in the Start of the navigation path Project Settings Next navigation step Info Next navigation step Localizations End of the navigation path.
  10. Add all required languages and select MobilePlace storyboard. Also select Localizable Strings as the type of localization. Each localization you add creates a copy of the technical language, and should appear under the Storyboard in the project navigator pane. Open these files and copy the content from the corresponding translation file shipped in the MobilePlace.bundle group. This involves manually overriding the generated content with the one shipped by SAP.
  11. Add the HttpConvAuthFlows.bundle to your project.
  12. Open the main UIViewController and add the following code to connect an IBAction from the storyboard's UIButton and implement mobile place call:
    -(IBAction)getMobilePlaceConfiguration:(id)sender {
        //get shared instance of the Mobile Place Controller
        MobilePlaceController *mobilePlaceController = [[MobilePlaceController alloc] init];
        
        //get configuration properties for the application
        //helper method to show activity indiciator
       [self showActivityIndicator];
       //present mobile place UI and use it to get configuration
    	//if an email parameter is provided then the UI will not be presented
        [mobilePlaceController configurationParametersWithEmail:nil appID:@"myApplicationId” versionNumber:@"1.0”  parentVC:self completionBlock:^(NSDictionary *configurationParameters, NSError *error) {
            [self closeActivityIndicator];
            if (error) {
                NSLog(@"Error: %@\nConfigurationParameters: %@", error, configurationParameters);
                NSString *errorDesc = [NSString stringWithFormat:@"Error: %@\nConfigurationParameters: %@", error, configurationParameters];
                [self displayText:errorDesc];
            }
            else {
                //set the configuration for the rest of the application logic
                _configurationParameters = configurationParameters;
                //log the actual content of the configurationProperties dictionary to the console
                NSLog(@"Configuration parameters received: %@", [configurationParameters description]);
                //set the content of the dictionary to be visible on the UI
                [self displayText:[configurationParameters description]];
            }
        }];
    }