Setting Up an iOS Client Application in Xcode

Goal: Set up an iOS client application in the Xcode IDE.

Prerequisites
Task
Note: This tutorial was developed using Xcode 4.0 and iOS SDK 4.3. If you use a different version of Xcode, some steps may vary. For more information on Xcode, refer to the Apple Developer Connection: http://developer.apple.com/technologies/tools/xcode.html.
  1. Start Xcode and select Create a new Xcode project.
  2. Select iOS Application and Window-based Application as the project template, and then click Next.
  3. Enter SUP101 as the Product Name, MyCorp as the Company Identifier, select Universal as the Device Family product, and then click Next.
  4. Select a location 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.

    Copy the files from your Windows machine in to the SUP101 folder that Xcode created to contain the generated source code.

  5. Connect to the Microsoft Windows machine where Sybase Unwired Platform is installed:
    1. From the Apple Finder menu, select Go > Connect to Server.
    2. Enter the name or IP address of the machine, for example, smb://<machine DNS name> or smb://<IP Address>.
      You see the shared directory.
  6. Navigate to the \UnwiredPlatform\ClientAPI\MBS\ObjectiveC directory in the Unwired Platform installation directory, and copy the includes and libs folders to the SUP101/SUP101 directory on your Mac.
  7. Navigate to the SUP101 mobile application project (for example, C:\Documents and Settings\administrator\workspace\SUP101), and copy the Generated Code folder to the SUP101/SUP101 directory on your Mac.
    When you have finished copying the files to your Xcode project, it should look like this:
    SUP iOS - Copied Files
  8. In the Xcode Project Navigator, right-click the SUP101 folder under the project, 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.
  9. Right-click the SUP101 folder under the project, select Add Files to "SUP101", navigate to the Temp/libs/Debug-iphonesimulator directory, select the libclientrt.a, libSUPObj.a, and libMO.a libraries, unselect Copy items into destination group's folder (if needed), and 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.
  10. Right-click the project root, select New Group, and then rename it to Resources.
  11. Right-click the Resources folder, select Add Files to "SUP101", navigate to the includes directory, select the Settings.bundle file, unselect Copy items into destination group's folder (if needed), and click Add.
    The bundle Settings.bundle is added to the project in the Project Navigator.

    This bundle adds resources that lets iOS device client users input information such as server name, server port, user name and activation code in the Settings application.

  12. Click the project root and then, in the middle pane, click the SUP101 project.
    1. In the right pane, click the Build Settings tab, then scroll down to the Search Paths section.
    2. Enter the location of your includes folder ("$SRCROOT/SUP101/includes/**") in the Header Search Paths field.
      $SRCROOT is a macro that expands to the directory where the Xcode project file resides.
  13. In the middle pane select the SUP101 target.
    1. In the right pane, select the Build Phases tab, then expand the Link Binary with Libraries section.
    2. Click the + icon below the list, select the following libraries, and then click Add to add them from the SDK to the project:
      • AddressBook.framework
      • CoreFoundation.framework
      • QuartzCore.framework
      • Security.framework
      • libicucore.A.dylib
      • libstdc++6.dylib
      • libz.1.2.3.dylib
  14. Select Product > Clean, then Product > Build to test the initial set up of the project. If you correctly followed this procedure, you see a Build Succeeded message.