Skip to content
yokoe edited this page Jul 26, 2011 · 8 revisions

Installing the SDK

What's necessary?

A developer account

You need an account to sign in http://pankia.com. Right now, we're accepting new sign-ups on a per-requrest basis, so you send us email to us.

Game Key / Game Secret

Sign in to http://pankia.com and add a new game. Then you will receive a game key / game secret pair in the game settings view. Keep in mind that game key and game secret are critical to verify the authenticity of your apps on Pankia. Do not reveal the information to anyone, and it is also advisable to crypt game secret in your customized way (e.g. ROT13) when you embed them in your source code. Beware that compromised game secret could allow cheating on leaderboards or achievements.

Download the Pankia SDK

Download the latest version of SDK.

The current version is 2.0.5.

Frameworks

Make sure that the following frameworks are added to your project.

  1. AddressBook
  2. CFNetwork
  3. CoreFoundation
  4. CoreGraphics
  5. GameKit
  6. MessageUI
  7. QuartzCore
  8. Security
  9. StoreKit
  10. SystemConfiguration
  11. libsqlite3
  12. Foundation
  13. UIKit

Integrate the SDK with your app

Add to project

Add the "Pankia" directory to your project.

Initialize Pankia

Pankia must be initialized at the moment when your app launches. Call initWithGameKey:gameSecret:title:delegate:options;] in application:didFinishLaunchingWithOptions: method.

#import "Pankia.h"

#define GAME_KEY @"1234..."
#define GAME_SECRET @"1234..."
#define GAME_TITLE @"SampleGame"

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    ....
    [Pankia initWithGameKey:GAME_KEY gameSecret:GAME_SECRET title:GAME_TITLE delegate:self options:launchOptions];
    ....
    return YES;
}

You specify game key, game secret, and game title. The game title will be displayed on the navigation bar on the dashboard.

Also specify an object that implements PankiaDelegate protocol, to which Pankia-driven events such as login completion should be delagated.

@interface PankiaNetSampleAppDelegate : NSObject <UIApplicationDelegate,PankiaDelegate> {
    UIWindow *window;
}
@property (retain) IBOutlet UIWindow *window;
@end

Auto login

Upon initialization of Pankia, the SDK attempts to login automatically. When it is successful, the delegate method -userDidLogin: will be invoked and you can access to the authenticated user's information.

- (void)userDidLogin:(PNUser *)user{
	NSLog(@"Signed in as %@", user.displayName());
}