This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
tutorials:using_openfeint_with_sparrow [2011/12/30 00:24] – enbr | tutorials:using_openfeint_with_sparrow [2013/03/05 10:19] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Using OpenFeint with Sparrow ===== | ||
+ | [[/ | ||
+ | \\ | ||
+ | \\ OpenFeint is a powerful social framework for iOS games. It makes it easy to handle achievements, | ||
+ | \\ [[http:// | ||
+ | |||
+ | This tutorial starts with the Sparrow scaffold. If you are not using the scaffold, your integration might be a little different. | ||
+ | |||
+ | == 1. Go to https:// | ||
+ | {{http:// | ||
+ | \\ If you already have an account, just create a new game from the developer dashboard. | ||
+ | == 2. Download the latest SDK from https:// | ||
+ | I am using the OpenFeint iOS 2.12.5 package. | ||
+ | == 3. Find OpenFeint.framework in the SDK package and add it to your Sparrow project. == | ||
+ | Also, add the correct configuration bundles for your project: | ||
+ | \\ | ||
+ | \\ 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. | ||
+ | \\ | ||
+ | \\ {{http:// | ||
+ | == 4. Add the following frameworks to your project. == | ||
+ | AddressBook | ||
+ | \\ AddressBookUI | ||
+ | \\ CFNetwork | ||
+ | \\ CoreLocation | ||
+ | \\ CoreText | ||
+ | \\ GameKit | ||
+ | \\ libsqlite3.0.dylib | ||
+ | \\ MapKit | ||
+ | \\ MobileCoreServices | ||
+ | \\ Security | ||
+ | \\ SystemConfiguration | ||
+ | {{http:// | ||
+ | \\ At this point, you should be able to build and run your app with no OpenFeint related warnings or errors. | ||
+ | == 5. Add the following code in ApplicationDelegate.h and .m. == | ||
+ | ApplicationDelegate.h | ||
+ | <code objc> | ||
+ | #import " | ||
+ | |||
+ | // Add OpenFeintDelegate after UIApplicationDelegate | ||
+ | @interface ApplicationDelegate : NSObject < | ||
+ | </ | ||
+ | ApplicationDelegate.m | ||
+ | <code objc> | ||
+ | // At the end of applicationDidFinishLaunching | ||
+ | NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys: | ||
+ | [NSNumber numberWithInt: | ||
+ | @" | ||
+ | #ifdef DEBUG | ||
+ | [NSNumber numberWithInt: | ||
+ | #else | ||
+ | [NSNumber numberWithInt: | ||
+ | #endif | ||
+ | nil]; | ||
+ | [OpenFeint initializeWithProductKey: | ||
+ | |||
+ | // Add these methods also | ||
+ | - (void)dashboardWillAppear { | ||
+ | [mSparrowView stop]; | ||
+ | } | ||
+ | |||
+ | - (void)dashboardDidDisappear { | ||
+ | [mSparrowView start]; | ||
+ | } | ||
+ | |||
+ | - (void)userLoggedIn: | ||
+ | NSLog(@" | ||
+ | } | ||
+ | |||
+ | // In the dealloc method | ||
+ | [OpenFeint shutdown]; | ||
+ | </ | ||
+ | == 6. Use these methods to open the OpenFeint dashboard. == | ||
+ | <code objc> | ||
+ | // You may need to #import " | ||
+ | [OpenFeint launchDashboard]; | ||
+ | [OpenFeint launchDashboardWithListLeaderboardsPage]; | ||
+ | [OpenFeint launchDashboardWithHighscorePage: | ||
+ | [OpenFeint launchDashboardWithAchievementsPage]; | ||
+ | [OpenFeint launchDashboardWithFindFriendsPage]; | ||
+ | [OpenFeint launchDashboardWithWhosPlayingPage]; | ||
+ | </ | ||
+ | == 7. Use these methods to submit scores and achievements. == | ||
+ | <code objc> | ||
+ | // You may need to #import " | ||
+ | [OFHighScoreService setHighScore: | ||
+ | [[OFAchievement achievement: | ||
+ | </ | ||
+ | == 8. Yay! You're done. == | ||
+ | Here is the sample project from this tutorial. | ||
+ | \\ [[http:// |