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.
- On your Mac, start Xcode and select Create a new Xcode project.
- Select iOS Application and
Single View Application as the project template, and
then click Next.
- Specify
these values and click Next.
- Enter SUP101 as the
product name.
- Enter MyCorp (or
another value as needed) as the company identifier.
- Select SUP101 for
the class prefix.
- Select Universal as the device family product.
- Unselect Use Storyboards.
- Unselect Use Automatic
Reference Counting.
- Unselect Include Unit
Tests.
- 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.
- Delete some of the automatically generated files created by default for the Xcode project.
- In Xcode, delete the SUP101 folder under the SUP101 project:
- Click Remove
References.
- In the Finder, manually delete the SUP101 folder from the project
folder.
- Verify that only the SUP101.xcodeproj file and the build folder are
in the SUP101 folder.
- Verify that the SDK and deployment targets are correct:
- Select SUP101 in Project Navigator and then select Build
Settings.
- Under Project, select SUP101.
- Verify that Base SDK under Architectures is set to
Latest iOS (iOS 6.0).
- Scroll to the Deployment section and set the iOS Deployment Target to
iOS 4.3 or higher.
- Select Targets > SUP101 and verify that those values are also
set.
- 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:
- Connect to the Microsoft Windows machine where Sybase Unwired Platform
is installed
- From the Apple Finder menu, select .
- 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.
- Copy the SUP_HOME\MobileSDK22\ObjectAPI\iOS folder from
the Unwired Platform
installation directory to the SUP101 folder on your
Mac.
- 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.
- 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.
- Ctrl-click the Framework
group, then select Add Files to "SUP101".
- In the iOS folder you copied from the Sybase Unwired Platform installation, navigate to
the Libraries/Debug-iphonesimulator
directory.
- Select the libAfariaSLL.a,
libclientrt.a,
libDatavault.a, libMO.a,
libPerformanceLib.a,
libsupClientUtil.a, libSUPObj.a,
libSUPSupportability.a, and libsupUltralite.a libraries.
- Unselect Copy items into
destination group's folder (if needed).
- 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.
- Add the source code files from the SUP101 iOS Object API
example project.
- In Xcode, Ctrl-click the SUP101 project and select
Add Files to "SUP101".
- Select the folder from the SUP101 tutorial ZIP
file.
- Select Copy items into
destination group's folder (if needed).
The project now looks like this:
Configuring the Build Settings
Configure the build settings for the Xcode project, then build the project.
- 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.
- 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
- 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.
- Hold the Option key, and select , then to test initial project setup. If you correctly followed this
procedure, you see a Build Succeeded message.
Comments
Post a Comment