Setting Up an iOS Client Application in Xcode for Sybase Unwired Platform

Set up an iOS client application in the Xcode IDE.
Prerequisites
  • Generate Objective-C code in to an output location.
  • Verify that Sybase Unwired Platform is installed in a shared directory so you can access it from your Mac.
  • To help create your project, and to later build the interface, download and import the SUP101 iOS Object API (2.2 SP02) example project from the SAP Community Network (SCN) at http://scn.sap.com/docs/DOC-8803.
  • Copy the SUP101 iOS Object API example project to your Mac machine and extract it into a folder. The example project contains the Xcode project and a SUP101 project archive file to use in Sybase Unwired WorkSpace.
Task
  1. On your Mac, start Xcode and select Create a new Xcode project.
  2. Select iOS Application and Single View Application as the project template, and then click Next.
  3. Specify these values and click Next.
    1. Enter SUP101 as the product name.
    2. Enter MyCorp (or another value as needed) as the company identifier.
    3. Select SUP101 for the class prefix.
    4. Select Universal as the device family product.
    5. Unselect Use Storyboards.
    6. Unselect Use Automatic Reference Counting.
    7. Unselect Include Unit Tests.
  4. Select a location in which to save the project and click Create to open it.
    Xcode creates a folder, SUP101, to contain the project file, SUP101.xcodeproj, and another SUP101 folder, which contains a number of automatically generated files and a build folder.
  5. Delete some of the automatically generated files created by default for the Xcode project.
    1. In Xcode, delete the SUP101 folder under the SUP101 project:
      1. Click Remove References.
      2. In the Finder, manually delete the SUP101 folder from the project folder.
      3. Verify that only the SUP101.xcodeproj file and the build folder are in the SUP101 folder.
  6. Verify that the SDK and deployment targets are correct:
    1. Select SUP101 in Project Navigator and then select Build Settings.
    2. Under Project, select SUP101.
    3. Verify that Base SDK under Architectures is set to Latest iOS (iOS 6.0).
    4. Scroll to the Deployment section and set the iOS Deployment Target to iOS 4.3 or higher.
    5. Select Targets > SUP101 and verify that those values are also set.
  7. Copy the files from the SUP101 folder on your Windows machine to the SUP101 folder on your Mac that Xcode created to contain the SUP101 project:
    1. Connect to the Microsoft Windows machine where Sybase Unwired Platform is installed
    2. From the Apple Finder menu, select Go > Connect to Server.
    3. Enter the name or IP address of the machine, for example, smb://<machine DNS name> or smb://<IP Address>, then click Connect.
      You see the shared directory.
    4. Copy the SUP_HOME\MobileSDK22\ObjectAPI\iOS folder from the Unwired Platform installation directory to the SUP101 folder on your Mac.
    5. On your Windows machine, navigate to the SUP101 mobile application project and copy the Generated Code folder to the SUP101 directory on your Mac.
     

Adding Source Code Files, Libraries, and Resources to the Xcode Project

Once you set up the initial project in Xcode, add files from the Sybase Unwired Platform folders you copied from your Windows machine.
  1. In the Xcode Project Navigator, Ctrl-click the SUP101 project, then select Add Files to "SUP101".
    Select the Generated Code folder, unselect Copy items into destination group's folder (if needed), and click Add.
    The Generated Code folder is added to the project in the Project Navigator.
  2. Ctrl-click the Framework group, then select Add Files to "SUP101".
    1. In the iOS folder you copied from the Sybase Unwired Platform installation, navigate to the Libraries/Debug-iphonesimulator directory.
    2. Select the libAfariaSLL.a, libclientrt.a, libDatavault.a, libMO.a, libPerformanceLib.a, libsupClientUtil.a, libSUPObj.a, libSUPSupportability.a, and libsupUltralite.a libraries.
    3. Unselect Copy items into destination group's folder (if needed).
    4. Click Add.
    The libraries are added to the project in the Project Navigator.
    Note: The library version corresponds to the configuration you are building. In this tutorial, you work with the libraries for the Debug version of the iPhone simulator.
  3. Add the source code files from the SUP101 iOS Object API example project.
    1. In Xcode, Ctrl-click the SUP101 project and select Add Files to "SUP101".
    2. Select the SUP101 > SUP101 folder from the SUP101 tutorial ZIP file.
    3. Select Copy items into destination group's folder (if needed).
    The project now looks like this:
    Project Summary

 

Configuring the Build Settings

 

Configure the build settings for the Xcode project, then build the project.
  1. In the right pane, click the Build Settings tab and scroll down to the Search Paths section. Enter the location of the iPhone simulator libraries in the Header Search Paths and Library Search Paths fields.
    $SRCROOT is a macro that expands to the directory where the Xcode project file resides. Adding this macro in front of the path is optional.
    • In Header Search Paths, enter the path to the iOS/includes directory, then select the recursive option. In this example, the path is indicated as iOS/includes/**.
    • In Library Search Paths, specify profiles for Debug and Release. In this example, the path is indicated as "iOS/Libraries/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)". Escape the path names using double quotes.

    Project Build Settings
  2. In the right pane, select the Build Phases tab, then expand the Link Binary with Libraries section.
    Click the + icon below the list, select the following libraries, and then click Add to add them to the project:
    • CFNetwork.framework
    • CoreFoundation.framework
    • libicucore.A.dylib
    • libstdc++.dylib
    • libz.dylib
    • MobileCoreServices.framework
    • Security.framework
    • SystemConfiguration.framework
  3. In the right pane, select the Build Phases tab, then expand the Copy Bundle Resources section. Select SUP101-info.plist and click on the - sign to remove it.
  4. Hold the Option key, and select Product > Clean Build Folder, then Product > Build to test initial project setup. If you correctly followed this procedure, you see a Build Succeeded message.

 

 

Comments

Popular posts from this blog

How to draw an overlay on a SurfaceView used by Camera on Android?

Create EditText with dropdown in android

Android TCP Connection Chat application