New in OpenFeint iOS SDK Version 2.9.1 This version is now OFX 2.0 compatible. See Changelog for other recent changes.
Prerequisites XCode version 3.2.2 or newer. Build with Base SDK of 3.0 or newer
Install and configure your development environment XCode version 3.2.2 or newer. Build with Base SDK of 3.0 or newer.
Register your game on the OpenFeint developer site The OpenFeint Developer Dashboard is the center of activity for developers working with OpenFeint. From here you will create your free developer account, download the OpenFeint SDK, and manage server side components of your projects. Go to the OpenFeint Developer Dashboard (https://api.openfeint.com/dd) Register or log in Use an email address for your identity with your chosen password. Important note: If you are already using an email address to log in as an OpenFeint game player, you will need to use a different email address to register as a developer. Use these instructions if you wish to change it. Select an existing game description or register a new one. Developer dash screenshot To retrieve game credentials such as the application ID and the game secret: In the Developer Dashboard (https://api.openfeint.com/dd), choose the game you will use with the application. Click the Application Information button to show the properties of the application you defined:
Browse basic features Achievements and leaderboards under the Features tab is a great place to start. Go ahead and define a new achievement or leaderboard as an experiment. Download the latest OpenFeint Android SDK for Android Click the Downloads button at the top of the page. Extract the downloaded package into a directory on your development computer. Locate OpenFeint Documentation and Support Resources The downloaded SDK includes a reference manual in the doc/index.html directory.
Download the latest OpenFeint SDK for iOS On the Developer Dashboard Click the Downloads tab at the top of the page. Extract the downloaded package into a directory on your development computer. Locate OpenFeint Documentation and Support Resources The downloaded SDK includes a reference manual that you can open by clicking documentation/README.html.
Build and run the OpenFeint Sample Application OpenFeint provides a sample application in the release to let you experiment with OpenFeint features and see OpenFeint best practice coding conventions before youve integrated OpenFeint into your own app. Once you do begin working with your own app, it is frequently helpful to come back to the sample app to see how individual features work and how they can best be implemented. To build the sample application: In the MyOpenFeintSample folder of the unzipped OpenFeint download, double-click the MyOpenFeintSample.xcodeproj project. XCode will launch. In the SampleAppDelegate folder in the XCode project, edit the file MyOpenFeintSampleAppDelegate as follows: Find the lines that read:
[OpenFeint initializeWithProductKey:your_product_key_here andSecret:your_product_secret_here andDisplayName:@"sample_app_name" andSettings:settings andDelegates:delegates];
Put the product key of your game into the your_product_secret_here string. Put the secret key of your game into the your_product_secret_here string. Put the displayable name of your application into the sample_app_name string. The result will look something like this:
[OpenFeint initializeWithProductKey:@"fllglfklgklglgks" andSecret:@"fldjsfjkhjg5653k3jklg" andDisplayName:@"example" andSettings:settings andDelegates:delegates];
Save the file. You might want to start by building for the emulator. If so, you might want your build settings to look something like this:
Build. Run. Play with the OpenFeint Dashboard, which will look something like this:
OpenFeint-enable your iOS game To OpenFeint-enable your iOS game: Make sure you have the current version of OpenFeint. Unzip the file. If you have previously used OpenFeint, delete the existing group reference from your project. If you have previously used OpenFeint, delete your build directory. Otherwise xcode might get confused and the game will crash because xcode didnt realize a .xib file changed. You may add OpenFeint as a framework or as individual source files. Choose one of these and do one of the following.
Add OpenFeint as a framework Drag and drop OpenFeint.framework onto your project in XCode. Drag and drop OFResources_configuration.bundle onto your project in XCode. Choose the configuration based on which platforms you support: If your game is iPhone landscape only, use OFResources_iPhone_Landscape.bundle. If your game is iPhone portrait only, use OFResources_iPhone_Portrait.bundle. If your game is iPad only, use OFResources_iPad.bundle. If your game is iPhone landscape and portrait, use OFResources_iPhone_Universal.bundle. All others use OFResources_Universal.bundle.
In your projects settings, add the value -all_load to Other Linker Flags. If your app supports iOS versions less than 4.0, you must weak-link libSystem for configurations that run on the device: Select Other Linker Flags in the build settings. Choose Add Build Setting Condition in menu in the lower-left corner. Change Any SDK to Any iOS Change the value to include -weak_library /usr/lib/libSystem.B.dylib
Add OpenFeint as individual source files Drag and drop the unzipped folder titled OpenFeint onto your project in XCode. Make sure its included as a group and not a folder reference. Remove unused asset folders. This is not a necessary step but helps cut down the application size. You need to do this every time you download a new OpenFeint project. If you are using OpenFeint as a framework, you need to delete these from OpenFeintResources.bundle. Right-click it in Finder, and show package contents to navigate to the files. If you are using OpenFeint as individual source files, you will need to delete these asset groups directly in XCode. If your game is landscape only or iPad only delete the iPhone_Portrait folder. If your game is portrait only or iPad only delete the iPhone_Landscape folder. If your game does not support the iPad delete the iPad folder.
Right click on your project icon in the Groups & Files pane. Select Get Info.
Select the Build tab. Make sure you have Configuration set to All Configurations.
Add the value -ObjC to Other Linker Flags
** NOTE: If the current value says
Make sure that the following frameworks are included in your link step: (do this by right clicking on your project and selecting Add->Existing Frameworks) Foundation UIKit CoreGraphics QuartzCore Security SystemConfiguration libsqlite3.0.dylib CoreServices CFNetwork AddressBook AddressBookUI GameKit CoreLocation MapKit libz.1.2.3.dylib (unless using OF_EXCLUDE_ZLIB as described below)
We recommend that you specify the latest available released version of the iOS SDK as your base SDK and specify iOS 3.0 as the deployment target so that your app will will also support older devices. Specify the base SDK in the pull down menu in the upper left of the XCode project window. Specify the deployment target in the project settings. OpenFeint does not support versions of iOS older than iOS 3.0. If you specify a deployment target older than the base SDK, the following frameworks should use weak linking: UIKit MapKit GameKit To specify weak linking, right click on the build target, select the General tab, and in the type column change from Required to Weak for the selected framework. You must have a prefix header. The following line must be in the prefix header: #import “OpenFeintPrefix.pch” Source files that reference OpenFeint in any way must be compiled with Objective-C++ (Use a .mm file extension, rather than .m). (Optional) Install the OpenFeint docset. In a terminal in the documentation directory, run ./InstallDocSet.shReleasing your title with OpenFeint
To release your title with OpenFeint: Register an Application on api.openfeint.com Use the ProductKey and ProductSecret for your registered application. When launching your app, OpenFeint will print out what servers it is using to the console/log using NSLog. NOTE: Make sure your application is using https://api.openfeint.com/ Make sure your offline configuration XML file is up to date. This file is downloadable in the developer dashboard under the Offline section. Download this file again every time you change something in the developer dashboard.