Game Development Reference
In-Depth Information
SLRequest* request = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SL
RequestMethodPOST URL:feedURL parameters:params];
request.account = facebookAccount;
[request performRequestWithHandler:^(NSData *responseData,
NSHTTPURLResponse *urlResponse, NSError *error) {
if (error){
NSLog(@"%@", error);
} else {
//Success
}
}];
}
facebookAccount
is set; if so, we create an
called
params
and populate it with the content of our post. The items in
params
are
SLRequest
object, being
requestMethod
,
SLRequestMethodPOST
. We also specify that the request
facebookAccount
. This makes sure that the request is properly
performRequestWithHandler
and pass in our
handler block.
In our case, there is not much to do in the handler block except to log if there was a problem. With
any luck, the user will see something like Figure
9-15
in their timeline.