Inherits from NSObject
Declared in NextpeerPublic.h

Overview

Vertical alignment – avatars are aligned top-down.

Tasks

Other Methods

  • + releaseVersionString

    The release Version String of the Nextpeer client library in use.

  • + initializeWithProductKey:andDelegates:

    This is your unique product key you received when registering your application. Is copied.

  • + initializeWithProductKey:andSettings:andDelegates:

    This is your unique product key you received when registering your application. Is copied.

  • + launchDashboard

    Launches the Nextpeer Dashboard view at the top of your application’s keyed window.

  • + dismissDashboard

    Removes the Nextpeer dashboard from your application’s keyed window.

  • + setNotificationOrientation:

    Call this method when you wish to change the notification orientation in run time. It’s preferable to use the settings dictionary if you wish to set this up at start-time.

  • + handleOpenURL:

    Let the platform handle a url request, this will used when the Facebook App redirects to the app during the SSO process.

  • + isNextpeerSupported

    Call this method to verify if the current run time environment supports Nextpeer requirements.

  • + registerDeviceToken:

    Call this method register this user’s device token. This will allow Nextpeer to send invitations to this user when he/she is invited to play the current game. Note that this is only relevant if you’ve followed the push notification integration instructions and provided the p12 file for your game.

  • + handleLaunchOptions:

    Call this method after the launching of the app. This allows Nextpeer to respond to any push or local notifications that may have been received when the app was in the background. Note that you will need to call this method after Nextpeer has already been initialized.

  • + handleRemoteNotification:

    Call this method after the receiving a remote push notification while the app is running.

  • + handleLocalNotification:

    Call this method after the receiving a local push notification while the app is running.

Social Methods

Feed Methods

Tournament Methods

Class Methods

dismissDashboard

Removes the Nextpeer dashboard from your application’s keyed window.

+ (void)dismissDashboard

Declared In

NextpeerPublic.h

enableRankingDisplay:

Call this method to enable or disable the in-game ranking display during a tournament. You can change this setting during a tournament (making the ranking display appear and disappear), but will not be animated.

+ (void)enableRankingDisplay:(BOOL)enableRankingDisplay

Parameters

enableRankingDisplay

YES if the ranking display should be enabled, NO otherwise.

Declared In

Nextpeer+Tournament.h

getCurrentPlayerDetails

Use this method to retrieve the current player details such as name and image.

+ (NPGamePlayerContainer *)getCurrentPlayerDetails

Discussion

Note: If the user never opened Nextpeer’s dashboard or Nextpeer was not initialized the method will return nil.

Declared In

Nextpeer+Social.h

handleLaunchOptions:

Call this method after the launching of the app. This allows Nextpeer to respond to any push or local notifications that may have been received when the app was in the background. Note that you will need to call this method after Nextpeer has already been initialized.

+ (BOOL)handleLaunchOptions:(NSDictionary *)launchOptions

Parameters

launchOptions

The launch options of the application, as reported by the iOS SDK.

Example:

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     [Nextpeer initializeWithProductKey:...];
     [Nextpeer handleLaunchOptions:launchOptions];
 }

Return Value

Returns a boolean value indicating if the notification will be handled by Nextpeer.

Declared In

NextpeerPublic.h

handleLocalNotification:

Call this method after the receiving a local push notification while the app is running.

+ (BOOL)handleLocalNotification:(UILocalNotification *)notification

Parameters

notification

The notification, as reported by the iOS SDK.

Example:

 - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
     [Nextpeer handleLocalNotification:notification];
 }

Return Value

Returns a boolean value indicating if the notification will be handled by Nextpeer.

Declared In

NextpeerPublic.h

handleOpenURL:

Let the platform handle a url request, this will used when the Facebook App redirects to the app during the SSO process.

+ (BOOL)handleOpenURL:(NSURL *)url

Parameters

url

The URL that was passed to the application delegate’s handleOpenURL method(s).

Return Value

YES if the url starts with np[app_id] and the SDK handled the request; NO if the attempt to handle the URL failed (not supported by the platform).

Discussion

Note: The SDK may launch the Nextpeer dashboard under some scenarios from this call.

Declared In

NextpeerPublic.h

handleRemoteNotification:

Call this method after the receiving a remote push notification while the app is running.

+ (BOOL)handleRemoteNotification:(NSDictionary *)userInfo

Parameters

userInfo

The user info for the notification, as reported by the iOS SDK.

Example:

 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
    [Nextpeer handleRemoteNotification:userInfo];
 }

Return Value

Returns a boolean value indicating if the notification will be handled by Nextpeer.

Declared In

NextpeerPublic.h

initializeWithProductKey:andDelegates:

This is your unique product key you received when registering your application. Is copied.

+ (void)initializeWithProductKey:(NSString *)productKey andDelegates:(NPDelegatesContainer *)delegatesContainer

Parameters

productKey

This is your unique product key you received when registering your application. Is copied.

delegatesContainer

The delegates container is retained but none of the delegates in the container are retained.

Declared In

NextpeerPublic.h

initializeWithProductKey:andSettings:andDelegates:

This is your unique product key you received when registering your application. Is copied.

+ (void)initializeWithProductKey:(NSString *)productKey andSettings:(NSDictionary *)settings andDelegates:(NPDelegatesContainer *)delegatesContainer

Parameters

productKey

This is your unique product key you received when registering your application. Is copied.

settings

The available settings are defined as NextpeerSettingXXXXXXXXXXXX. See NextpeerSettings.h.

delegatesContainer

The delegates container is retained but none of the delegates in the container are retained.

Declared In

NextpeerPublic.h

isCurrentlyInTournament

Call this method to check if any tournament is running at the moment.

+ (BOOL)isCurrentlyInTournament

Declared In

Nextpeer+Tournament.h

isNextpeerSupported

Call this method to verify if the current run time environment supports Nextpeer requirements.

+ (BOOL)isNextpeerSupported

Return Value

YES if the run time requirements match, NO otherwise.

Discussion

Note: Minimum iOS version supported by the SDK is iOS 4.0. You can handle such case by implementing the

   [NextpeerDelegate nextpeerNotSupportedShouldShowCustomError] method (otherwise Nextpeer will display alert).

Declared In

NextpeerPublic.h

launchDashboard

Launches the Nextpeer Dashboard view at the top of your application’s keyed window.

+ (void)launchDashboard

Discussion

Note: If [Nextpeer isNextpeerSupported] returns NO this method will not execute. If the player has not yet authorized your app, they will be prompted to setup an account or authorize your application before accessing the Nextpeer dashboard.

Declared In

NextpeerPublic.h

openFeedDashboard

Use this method to open Nextpeer’s feed dashboard.

+ (void)openFeedDashboard

Declared In

Nextpeer+Feed.h

postToFacebookWallMessage:link:imageUrl:

Use this method to invoke the Facebook post dialog. The user will be prompted to login if she hasn’t done that before.

+ (void)postToFacebookWallMessage:(NSString *)message link:(NSString *)link imageUrl:(NSString *)imageUrl

Parameters

message

Message to be displayed on the wall. Must be specified.

link

Link for the given post. Could link to anywhere. If nil then the link would be to the app’s iTunes page (what was specified in Nextpeer’s dashboard).

imageUrl

URL for an image to be displayed on the post. If nil then the image is the app’s icon as it appears in Nextpeer’s dashboard.

Declared In

Nextpeer+Social.h

pushDataToOtherPlayers:

This method is used to push a buffer to the other players. This can potentially be used to create custom notifications or some other interactive mechanism that incorporates the other players. The buffer will be sent to the other players and will activate the [NPTournamentDelegate nextpeerDidReceiveTournamentCustomMessage:] method on their delegate.

+ (void)pushDataToOtherPlayers:(NSData *)data

Parameters

data

The data to broadcast to the other players.

Declared In

Nextpeer+Tournament.h

pushMessageToOtherPlayers:

This method will broadcast a notification to the other players in the tournament. The current player’s image will be displayed along with the text.

+ (void)pushMessageToOtherPlayers:(NSString *)message

Discussion

To use the current player’s name in the message use %PLAYER_NAME%. E.g., @“%PLAYER_NAME% sent you a bomb!”

@deprecated In-game notifications are no longer used, so this method is deprecated and will have no effect. Consider using [Nextpeer pushDataToOtherPlayers:] instead.

Declared In

Nextpeer+Tournament.h

registerDeviceToken:

Call this method register this user’s device token. This will allow Nextpeer to send invitations to this user when he/she is invited to play the current game. Note that this is only relevant if you’ve followed the push notification integration instructions and provided the p12 file for your game.

+ (void)registerDeviceToken:(NSData *)deviceToken

Parameters

deviceToken

The device token, as reported by the iOS SDK.

Example:

 - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
     // Updates the device token and registers the token with Nextpeer
     [Nextpeer registerDeviceToken:deviceToken];
 }

Declared In

NextpeerPublic.h

registerToSynchronizedEvent:withTimetout:

Registers to a synchronized event.

+ (void)registerToSynchronizedEvent:(NSString *)eventName withTimetout:(NSTimeInterval)timeout

Parameters

eventName

The name of the synchronized event to register to.

timeout

The maximum amount of time to wait for all other participants to register for the sync event.

Discussion

A synchronized event can be used to synchronize all players at a particular point in the game. For example, at the beginning of the game, each client may need to load resources, which takes variable time, depending on the player’s device. The event will be fired (see [NPTournamentDelegate nextpeerDidReceiveSynchronizedEvent:withReason:]) either when everyone registered for it, or after the specified timeout, and all players will receive it at the same time.

When working with synchronized events, you should be aware of the following edge cases:

  1. Clients who are too late to register to an event will not be notified of the event until they register.
  2. Recordings will pause when they register to an event that wasn’t registered to by a real player, and will wait until the event is fired due the registration of a live player(s).
  3. Recordings that are late to register to an event will behave just as regular clients, and will continue their playback as usual.

Declared In

Nextpeer+Tournament.h

releaseVersionString

The release Version String of the Nextpeer client library in use.

+ (NSString *)releaseVersionString

Return Value

The release Version String of the Nextpeer client library in use.

Declared In

NextpeerPublic.h

reportControlledTournamentOverWithScore:

Call this method when your game manages the current tournament and the player just died (a.k.a. ‘Last Man Standing’). Nextpeer will call the [NextpeerDelegate nextpeerDidTournamentEnd] method after reporting the last score.

+ (void)reportControlledTournamentOverWithScore:(uint32_t)score

Parameters

score

The final score of the player.

Discussion

Note: The method will act only if the current tournament is from a ‘GameControlled’ tournament type.

Declared In

Nextpeer+Tournament.h

reportForfeitForCurrentTournament

Call this method when the user wishes to exit the current tournament. This will close any in-game notifiactions and dialogs.

+ (void)reportForfeitForCurrentTournament

Declared In

Nextpeer+Tournament.h

reportScoreForCurrentTournament:

Call this method to report the current score for the tournament. This allows Nextpeer to send various notifications about the players' scores.

+ (void)reportScoreForCurrentTournament:(uint32_t)score

Parameters

score

The player’s current score.

Declared In

Nextpeer+Tournament.h

reportScoreModifier:forRecording:

Call this method to change the score modifier of the giving recording. The modifier can be negative or positive and thus points will either be added or reduced from the recording’s score.

+ (void)reportScoreModifier:(int32_t)modifier forRecording:(NSString *)recordingPlayerId

Parameters

modifier

The score modifire to apply to the recording.

recordingPlayerId

The player ID of the target recording (see [NPTournamentPlayer playerId]).

Declared In

Nextpeer+Tournament.h

requestFastForwardRecording:withTimeDelta:

Call this method to fast forwad the given recording by timeDelta milliseconds.

+ (void)requestFastForwardRecording:(NSString *)recordingPlayerId withTimeDelta:(uint32_t)timeDelta

Parameters

recordingPlayerId

The player ID of the target recording (see [NPTournamentPlayer playerId]).

timeDelta

The interval (in milliseconds) by which to fast-forward the recording.

Declared In

Nextpeer+Tournament.h

requestPauseRecording:

Call this method to pause the given recording.

+ (void)requestPauseRecording:(NSString *)recordingPlayerId

Parameters

recordingPlayerId

The player ID of the target recording (see [NPTournamentPlayer playerId]).

Declared In

Nextpeer+Tournament.h

requestResumeRecording:

Call this method to resume the given recording.

+ (void)requestResumeRecording:(NSString *)recordingPlayerId

Parameters

recordingPlayerId

The player ID of the target recording (see [NPTournamentPlayer playerId]).

Declared In

Nextpeer+Tournament.h

requestRewindRecording:withTimeDelta:

Call this method to rewind the given recording by timeDelta milliseconds.

+ (void)requestRewindRecording:(NSString *)recordingPlayerId withTimeDelta:(uint32_t)timeDelta

Parameters

recordingPlayerId

The player ID of the target recording (see [NPTournamentPlayer playerId]).

timeDelta

The interval (in milliseconds) by to rewind the recording.

Declared In

Nextpeer+Tournament.h

requestStopRecording:

Call this method to stop the given recording.

+ (void)requestStopRecording:(NSString *)recordingPlayerId

Parameters

recordingPlayerId

The player ID of the target recording (see [NPTournamentPlayer playerId]).

Declared In

Nextpeer+Tournament.h

resumePlayAgainLogic

Call this method when you have finished running the inter-game logic. The player will be taken to their next tournament.

+ (void)resumePlayAgainLogic

Declared In

Nextpeer+Tournament.h

setNotificationOrientation:

Call this method when you wish to change the notification orientation in run time. It’s preferable to use the settings dictionary if you wish to set this up at start-time.

+ (void)setNotificationOrientation:(UIInterfaceOrientation)orientation

Discussion

@deprecated This method no longer has any effect. Please use the NextpeerSettingNotificationOrientation and NextpeerSettingObserveNotificationOrientationChange keys in NextpeerSettings.h.

Declared In

NextpeerPublic.h

timeLeftInTournament

This method will return the amount of seconds left for this tournament.

+ (NSUInteger)timeLeftInTournament

Return Value

The number of seconds left in the tournament, or 0 if there is no ongoing tournament or if the tournament is not time-based.

Declared In

Nextpeer+Tournament.h

unreliablePushDataToOtherPlayers:

This method is used to push a buffer to the other players in an unreliable fashion. This is usually used to update other game clients about the current game state for this specific player. The buffer will be sent to the other players and will activate the [NPTournamentDelegate nextpeerDidReceiveUnreliableTournamentCustomMessage:] method on their delegate. The data is not guranteed to reach all or even any of the players. Use this method when you need a low latency data transfer.

+ (void)unreliablePushDataToOtherPlayers:(NSData *)data

Parameters

data

The data to broadcast to the other players.

Discussion

Warning: Unerliable data is limited to just 1300 bytes, any buffers over that size will be discarded with a warning to the console.

Declared In

Nextpeer+Tournament.h