-
Notifications
You must be signed in to change notification settings - Fork 0
Installing the SDK
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.
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 latest version of SDK.
The current version is 2.0.5.
Make sure that the following frameworks are added to your project.
- AddressBook
- CFNetwork
- CoreFoundation
- CoreGraphics
- GameKit
- MessageUI
- QuartzCore
- Security
- StoreKit
- SystemConfiguration
- libsqlite3
- Foundation
- UIKit
Add the "Pankia" directory to your project.
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
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());
}