Importing Libraries and Code

Import the generated MBO code and associated libraries into the iOS development environment.

Note: For more information on Xcode, refer to the Apple Developer Connection: http://developer.apple.com/tools/Xcode/.
  1. Start Xcode 5 and select Create a new Xcode project.
  2. Select iOS Application and select an appropriate project template, and then click Next.
  3. Enter <ProjectName> as the Product Name, <Company Identifier> as the Company Identifier, select Universal as the Device Family product, and then click Next.
    Note: If you will deploy more than one Xcode project with the same application name, the applications will overwrite each other on the device. Ensure that projects do not share the same name even though they have different application IDs.
  4. Select a location to save the project and click Create to open it.

    Xcode creates a folder,<ProjectName>, to contain the project file, <ProjectName>.xcodeproj and another <ProjectName> folder, which contains a number of automatically generated files.

  5. Select the Architectures section under Build Settings, and set Base SDK for All Configurations to iOS 7.0.


  6. Select the Valid Architectures with the default value armv7 armv7s, Supported Platforms as iOS, and the Targeted device family as iPhone/iPad. This ensures that the build of the application can run on either iPhone or iPad.
  7. Scroll to the Deployment section and set the iOS Deployment Target as appropriate for the device version where you will deploy. The minimum version is iOS 4.3 or later. Earlier SDKs and deployment targets are not supported.
  8. Copy the files from your Windows machine to the <ProjectName> folder that Xcode created to contain the generated source code. 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.
  9. Navigate to the SUP_HOME\MobileSDK<version>\ObjectAPI\iOS directory, and copy the includes and Libraries folders to the <ProjectName>/<ProjectName> directory on your Mac.
  10. Navigate to the mobile application project (for example, C:\Documents and Settings\administrator\workspace\<ProjectName>), and copy the Generated Code folder to the <ProjectName>/<ProjectName> directory on your Mac.
  11. Right-click the <ProjectName> folder under the project, select Add Files to "<ProjectName>", navigate to the <ProjectName/ProjectName>/Libraries/Debug-iphonesimulator directory, select the libclientrt.a, libSUPObj.a, libMo.a, libPerformanceLib.a, libsupClientUtil.a, libSUPSupportability.a, libAfariaSLL.a, libDatavault.a, and libsupUltralite.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. For example, if you are building for a debug version of the simulator, navigate to Libraries/Debug-iphonesimulator/ to add the libraries.

    As an alternative to adding static libraries to the project, you can configure your project to specify the libraries in the project's build settings:

    • Select the project from the Project Navigator.
    • Click on the target under Targets and select Build Settings.
    • In the Linking section, expand Other Linker Flags.
    • Under Debug, add the following linker flags:
      $(SRCROOT)/$(PRODUCT_NAME)/Libraries/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/libMo.a
      $(SRCROOT)/$(PRODUCT_NAME)/Libraries/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/libSUPObj.a
      $(SRCROOT)/$(PRODUCT_NAME)/Libraries/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/libclientrt.a
      $(SRCROOT)/$(PRODUCT_NAME)/Libraries/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/libPerformanceLib.a
      $(SRCROOT)/$(PRODUCT_NAME)/Libraries/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/libsupClientUtil.a
      $(SRCROOT)/$(PRODUCT_NAME)/Libraries/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/libSUPSupportability.a
      $(SRCROOT)/$(PRODUCT_NAME)/Libraries/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/libAfariaSLL.a
      $(SRCROOT)/$(PRODUCT_NAME)/Libraries/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/libDatavault.a
      $(SRCROOT)/$(PRODUCT_NAME)/Libraries/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/libsupUltralite.a 
      

      These linker flags resolve for all builds of the project.

  12. Click the project root, in the middle pane click the <ProjectName> project, and set Objective-C Automatic Reference Counting in the Apple LLVM compiler 4.1 - Language section to No.
  13. Click on the active target and modify the Library Search Path from the Building Settings. For example:
    $(SRCROOT)/../iOS/Libraries/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)

    Enter the path to the location where you copied the libraries. Specify separate profiles for debug and release, and specify "any iOS" and "any iOS simulator." Ensure that you escape the paths using double quotes.



  14. Click on the active target, and modify the Header Search Path from Building Settings.
    Specify the path to the location where you copied the include files, and select the Recursive checkbox. The header files in the client library are grouped into subdirectories public and internal, so the recursive option is required.
  15. Add the following frameworks from the SDK to your project by clicking on the active target, and selecting Build Phase > Link Binary With Libraries. Click on the + button and select the following binaries from the list:
    • CoreFoundation.framework
    • Security.framework
    • CFNetwork.framework
    • SystemConfiguration.framework
    • MobileCoreServices.framework
    • libicucore.A.dylib
    • libstdc++.6.0.9.dylib
    • libz.dylib
  16. Hold the Option key, and select Product > Clean Build Folder and then Product > Build to test the initial set up of the project. If you have correctly followed this procedure, then you should receive a Build Succeeded message.
  17. Click on the active target, select the Info tab, change the "Application requires iPhone environment" setting to "Application does not run in background," and set to YES.
    Note: If you want to allow your application to continue to run safely in the background, do not perform this step. See Developer Guide: iOS Object API Applications > Development Task Flow for Object API Applications > Creating a Project > Managing the Background State.
  18. Write your application code to reference the generated MBO code. See the Developer Guide: iOS Object API Applications for information about referencing the iOS Client Object API.