PlayerIO

The fastest way to build online games without breaking a sweat.

Objective-C Client Reference

Multiplayer  class documentationClass PlayerIO

Language: Objective-C

Entry class for the initial connection to Player.IO.

Here is an example of using the class to authenticate to Player.IO:

Methods

 
+ (PIOAdTrack*)
adTrack
Get access to AdTrack service. Please see the AdTrack documentation page at Yahoo Games Network website for setup instructions.
+ (void)
authenticateWithGameId:connectionId:authenticationArguments:playerInsightSegments:successBlock:
Connects to Player.IO using as the given user
+ (void)
authenticateWithGameId:connectionId:authenticationArguments:playerInsightSegments:successBlock:errorBlock:
Connects to Player.IO using as the given user
+ (NSString*)
calcAuth256WithUserId:sharedSecret:
Calculate an auth hash for use in the connect method.
+ (NSString*)
calcAuthWithUserId:sharedSecret:
Calculate an auth hash for use in the connect method.
+ (PIOGameFS*)
gameFSWithGameId:
Get access to GameFS for a specific game, without connecting to the game.
+ (void)
handlePlayLinkWithURL:
Place the code below at the beginning of your "application:didFinishLaunchingWithOptions:" method to handle PlayLinks if ([launchOptions objectForKey:UIApplicationLaunchOptionsURLKey]){ [PlayerIO handlePlayLinkWithURL:[launchOptions objectForKey:UIApplicationLaunchOptionsURLKey]]; }
+ (void)
logout
Shut down the client and remove all stored credentials.

adTrack

Get access to AdTrack service. Please see the AdTrack documentation page at Yahoo Games Network website for setup instructions.

Return Value

PIOAdTrack*

authenticateWithGameId:connectionId:authenticationArguments:playerInsightSegments:successBlock:

Connects to Player.IO using as the given user

Arguments

NSString* gameId
The game id of the game you wish to connect to. This value can be found in the admin panel
NSString* connectionId
The id of the connection, as given in the settings section of the admin panel. 'public' should be used as the default
NSDictionary* authenticationArguments
A dictionary of arguments for the given connection.
NSArray* playerInsightSegments
Custom segments for the user in PlayerInsight.
void(^)(PIOClient*client) successBlock
Callback block with the client object when connected

authenticateWithGameId:connectionId:authenticationArguments:playerInsightSegments:successBlock:errorBlock:

Connects to Player.IO using as the given user

Arguments

NSString* gameId
The game id of the game you wish to connect to. This value can be found in the admin panel
NSString* connectionId
The id of the connection, as given in the settings section of the admin panel. 'public' should be used as the default
NSDictionary* authenticationArguments
A dictionary of arguments for the given connection.
NSArray* playerInsightSegments
Custom segments for the user in PlayerInsight.
void(^)(PIOClient*client) successBlock
Callback block with the client object when connected
void(^)(PIOError*error) errorBlock
Callback block that will be called instead of successCallback if an error occurs during the connect.

calcAuth256WithUserId:sharedSecret:

Calculate an auth hash for use in the connect method.

Arguments

NSString* userId
The userid to use when generating the hash
NSString* sharedSecret
The shared secret to use when generating the hash. This must be the same value as the one given to a connection in the admin panel.

Return Value

NSString* The generated auth hash (based on SHA-256)

calcAuthWithUserId:sharedSecret:

Calculate an auth hash for use in the connect method.

Arguments

NSString* userId
The userid to use when generating the hash
NSString* sharedSecret
The shared secret to use when generating the hash. This must be the same value as the one given to a connection in the admin panel.

Return Value

NSString* The generated auth hash. (This is based on SHA-1, which has been deprecated. Use CalcAuth256 for values based on SHA-256.)

gameFSWithGameId:

Get access to GameFS for a specific game, without connecting to the game.

Arguments

NSString* gameId
the gameid of the game to connect to

Return Value

PIOGameFS* An instance of PIOGameFS.

handlePlayLinkWithURL:

Place the code below at the beginning of your "application:didFinishLaunchingWithOptions:" method to handle PlayLinks if ([launchOptions objectForKey:UIApplicationLaunchOptionsURLKey]){ [PlayerIO handlePlayLinkWithURL:[launchOptions objectForKey:UIApplicationLaunchOptionsURLKey]]; }

Arguments

NSURL* url
The URL passed in as part of the application:didFinishLaunchingWithOptions: invocation

logout

Shut down the client and remove all stored credentials.