Public Member Functions | Static Public Member Functions | Properties

OFChallenge Class Reference

#import <OFChallenge.h>

List of all members.

Public Member Functions

(OFChallenge *) - initWithDefinition:challengeDescription:challengeData:
(void) - displayAndSendChallenge
(OFRequestHandle *) - sendChallenge:toUsers:inResponseToChallenge:
(OFRequestHandle *) - downloadChallengeData
(BOOL) - usesChallengeData

Static Public Member Functions

(void) + setDelegate:
(NSString *) + getResourceName

Properties

OFChallengeDefinitionchallengeDefinition
OFUserchallenger
NSString * challengeDescription
NSString * userMessage
NSString * hiddenText
NSData * challengeData
NSString * challengeDataUrl

Detailed Description

The public interface for OFChallenge allows you to create a challenge and send it to other users or qurery challenge data (if its a member of an OFChallengeToUser).


Member Function Documentation

- (void) displayAndSendChallenge

Displays the default OpenFeint View for sending Challenges. If the user submits this view the challenge will be sent to the players selected in the view.

Note:
If this is called, there is no need to call sendChallenge:
When this UI is displayed, it will fill prompt the user to fill out the user message so there is no need to fill out this optional data.
Currently hiddenText, and sending challenges as a response to a challenge are not supported through this call.
- (OFRequestHandle*) downloadChallengeData

Download's challenge data for a particular challenge.

Parameters:
challengeDataUrlThe url of the blob (OFChallengeToUser's challengeDataUrl property)
Note:
You should never have to call this function directly unless you implement your own UI. If you are using the OpenFeint views to accept challenges, then you should checkout out OFChallengeDelegate's - (void)userLaunchedChallenge:(OFChallengeToUser*)challengeToLaunch withChallengeData:(NSData*)challengeData; method.
Returns:
OFRequestHandle for the server request. Use this to cancel the request
Note:
Invokes - (void)didDownloadChallengeData:(NSData*)data OFChallenge:(OFChallenge*)challenge on success and
  • (void)didFailDownloadChallengeDataOFChallenge:(OFChallenge*)challenge on failure
+ (NSString*) getResourceName
- (OFChallenge*) initWithDefinition: (OFChallengeDefinition *)  definition
challengeDescription: (NSString *)  text
challengeData: (NSData *)  data 

Initializes a challenge

Parameters:
definitionThe the challenge definition
textShould state what needs to be fullfilled to complete the challenge
dataThe data needed to replay the challenge
Note:
You may optionally also fillout userMessage A message entered by the user specific to this challenge. If the user does not enter one a default message should be provided instead hiddenText Not used directly by OpenFeint. Use this if you want to display any extra data with the challenge when implementing your own UI
- (OFRequestHandle*) sendChallenge: (OFChallengeDefinition *)  challengeDefinition
toUsers: (NSArray *)  userIds
inResponseToChallenge: (OFChallenge *)  instigatingChallenge 

Sends a challenge to a list of users. Use this call when you create your own UI for challenges.

Parameters:
toUsersArray of NSStrings with the id of the users who will receive the challenge (OFUsers resourceId property)
inResponseToChallengeFor multi attempt challenges only. This is an optional parameter that is currently only used to track statistics on whether a challenge was created directly or as a "re-challenge" after beating a challenge.
Note:
If you call displayAndSendChallengeStart you should not call this function directly.
Invokes - (void)didSendChallenge: on success and
  • (void)didFailSendChallenge: on failure.
Returns:
OFRequestHandle for the server request. Use this to cancel the request
+ (void) setDelegate: (id< OFChallengeSendDelegate >)  delegate

Set a delegate for all OFChallenge related actions. Must adopt the OFChallengeDelegate protocol.

Note:
Defaults to nil. Weak reference
- (BOOL) usesChallengeData

Property Documentation

- (NSData *) challengeData [read, assign]
- (NSString *) challengeDataUrl [read, assign]
- (OFChallengeDefinition *) challengeDefinition [read, assign]

The Challenge Definition related to this challenge

- (NSString *) challengeDescription [read, assign]

The Challenge Description

- (OFUser *) challenger [read, assign]

The challenger

Note:
When calling sendChallenge:... this is nil b/c the challenger is always the current user
- (NSString *) hiddenText [read, write, retain]

hidden text field defined by the developer.

- (NSString *) userMessage [read, write, retain]

The user message for the challenge


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations Enumerator Properties