Setting Up an iPhone Client Application in Xcode

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

Prerequisites
Create and deploy your mobile business objects, and generate Objective-C code into an output location.
Note: Ensure the directory where Sybase Unwired Platform is installed is a shared directory so you can access it from your Mac.
Task
Note: This tutorial was developed using Xcode 3.2.3 and iPhone SDK 4.0. 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/tools/Xcode/.
  1. In the Xcode IDE, select Menu > New Project, then select the Windows-based Application template.
    The project you create sets up the basic application environment.
  2. In the new SUP101 project, in Active SDK, select iPhoneSimulator 4.0 and set the Active Configuration to Debug.
  3. Connect to the Microsoft Windows machine where Sybase Unwired Platform is installed:
    1. From the Apple 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.
  4. In the Home directory on your Mac, create a new folder named SUP101.
  5. Copy the includes and libs folders from <Unwired Platform Installation>\Servers\UnwiredServer\ClientAPI\ObjectiveC to the Home/SUP101 directory on your Mac.
  6. Copy the generated code for the SUP101 mobile application project from your Microsoft Windows environment, for example, C:\Documents and Settings\administrator\workspace\SUP101\Generated Code, to the Home/SUP101 directory on your Mac.
  7. Add the generated *.h and *.m files to the Xcode project.
    1. In the Xcode Groups & Files pane, right-click the SUP101 project and select Add > Existing Files.
    2. Select the Generated Code folder you copied to your Home directory (Home/SUP101/Generated Code) and click Add.
    3. Select the Copy items into destination group's folder (if needed) option and click Add.
  8. Add the libclientrt.a, libSUPObj.a, and libMO.a to your Xcode project:
    1. In the Xcode Groups & Files pane, right-click SUP101 and select Add > Existing Files.
    2. Navigate to the directory where you copied the libraries, Home/SUP101/libs.
    3. Open the Debug-iphonesimulator folder, select the libclientrt.a, libSUPObj.a, and libMO.a libraries and click Add.
      Note: The library version should correspond to the configuration you are building. For example, if you are building a configuration for a debug version of the simulator, then add the libraries to libs/Debug-iphonesimulator/.
    4. Select the Copy items into destination group's folder (if needed) option and click Add.
  9. Add Settings.bundle to the Xcode project.
    This allows the iPhone device client user to use the Settings application to input his or her user preference information such as server name, server port, user name, and activation code.
    1. In the Xcode Groups & Files pane, right-click Resources, and select Add > Existing Files.
    2. Navigate to the includes directory that you copied from the <Unwired Platform Installation>\Servers\UnwiredServer\ClientAPI\ObjectiveC to the Home/SUP101 directory on your Mac, select Settings.bundle, and click Add.
    3. Select the Copy items into destination group's folder (if needed) option and click Add.
  10. Enter the Xcode project Header Search Paths:
    1. Select Project > Edit Active Target SUP101.
    2. Click Build.
    3. Scroll down to the Search Paths section and in Header Search Paths, verify the location where you copied the include files, Home/SUP101/includes/**.
  11. Click General, then click the + icon at the bottom-left corner of the window to add these libraries from the SDK to the project:
    • Security.framework
    • AddressBook.framework
    • QuartzCore.framework
    • CoreFoundation.framework
    • libicucore.A.dylib
    • libz.1.2.3.dylib
    • libstdc++.dylib
  12. Click the Build tab, go to Library Search Paths, and remove any path that points to libstdc++.