Readme for OpenFeint iOS SDK 2.9.1 Part 2

How To Use OpenFeint Initializing OpenFeint Initialize OpenFeint on the title screen after youve displayed any splash screens. When you first initialize OpenFeint, it presents a modal dialog box to conform with Apple regulations. To initialize OpenFeint, use this function call:

[OpenFeint initializeWithProductKey:andSecret:andDisplayName:andSettings:andDelegates:];

ProductKey and Secret are strings obtained by registering your application at DisplayName is the string name we will use to refer to your application throughout OpenFeint. Settings is dictionary of settings (detailed below) that allow you to customize OpenFeint. Delegates is a container object that allows y ou to provide desired delegate objects pertaining to specific OpenFeint features.

OpenFeint configuration settings Settings are provided to OpenFeint as an NSDictionary. Here is an example of how to create a settings dictionary for use with the initialize method:

NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:

  [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft],

  @"ShortName", OpenFeintSettingShortDisplayName,

  NSNumber numberWithBool:YES], OpenFeintSettingEnablePushNotifications,

  [NSNumber numberWithBool:NO], OpenFeintSettingDisableChat,



More information about each of these settings can be found below. These settings are also described in OpenFeintSettings.h.

OpenFeintSettingRequireAuthorization deprecated.
OpenFeintSettingDashboardOrientation Specifies orientation in which the OpenFeint dashboard will appear.
OpenFeintSettingShortDisplayName In certain areas where the application display name is too long, OpenFeint uses this more compact version of your applications display name. For example, this variable is used for the title of the current game tab in the OpenFeint dashboard.
OpenFeintSettingEnablePushNotifications Specifies whether or not your application will be enabling Push Notifications (for Social Challenges, currently).
OpenFeintSettingDisableChat Allows you to disable chat for your entire application.

If you are only using an OpenFeintDelegate you may use the simple convenience constructor:

[OFDelegatesContainer containerWithOpenFeintDelegate:];
- (void)dashboardWillAppear;
 - (void)dashboardDidAppear;
 - (void)dashboardWillDisappear;
 - (void)dashboardDidDisappear;
 - (void)playerLoggedIn:(NSString*)playerId;
 - (BOOL)showCustomOpenFeintApprovalScreen;

This method is invoked when OpenFeint is about to show the welcome / approval screen that asks a player if they would like to use OpenFeint. You can learn more about customizing the approval screen here. OFNotificationDelegate This delegate deals with the in-game notification pop-ups that OpenFeint displays in response to certain events including high score submission, achievement unlocks, and social challenges. You can find more details in the API feature article on notification pop-ups OFChallengeDelegate This delegate deals with the Social Challenges API feature. You can find more details in the Social Challenges feature article. Launching the OpenFeint dashboard The most basic launch of the OpenFeint dashboard is accomplished with a single function call:

[OpenFeint launchDashboard];
[OpenFeint launchDashboardWithDelegate:];
 + (void)launchDashboardWithAchievementsPage;
 + (void)launchDashboardWithChallengesPage;
 + (void)launchDashboardWithFindFriendsPage;
 + (void)launchDashboardWithWhosPlayingPage;

Invoke this method to launch the OpenFeint dashboard to a page which lists OpenFeint friends who are also playing your application. Orientation and View Controller information The OpenFeint dashboard can be displayed in any orientation you desire. It will not, however, change orientations while it is being displayed. Developers use the OpenFeintSettingDashboardOrientation to control the initial orientation. If you wish to change the orientation over the course of the application you may invoke: [OpenFeint setDashboardOrientation:];

Generally this is done by applications which want to support multiple orientations in the UIViewController method didRotateFromInterfaceOrientation:. If your application is using a view controller with a non-portrait layout then you are required to invoke and return the following method in your UIViewControllers shouldAutorotateToInterfaceOrientation method. [OpenFeint shouldAutorotateToInterfaceOrientation:withSupportedOrientations:andCount:]; Here is an example implementation of shouldAutorotateToInterfaceOrientation:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{

  const unsigned int numOrientations = 4;

  UIInterfaceOrientation myOrientations[numOrientations] = {





return [OpenFeint shouldAutorotateToInterfaceOrientation:interfaceOrientation



Continue reading