我刚刚通过ios 6将facebook整合到我的应用程序中,但我在墙上发帖时遇到了一个问题.它只是说"post via ios app".我想说"posted via the app name".我在facebook上做了一个应用程序标识,我有他们指定的应用程序号,但我不知道如何将其与facebook集成.
下面是我的代码.如果有人能帮忙,我们将不胜感激.谢谢
{
NSString *message;
message= [[NSString alloc] initWithFormat:@"I've earned %@ points", [self retrieveScore]];
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:message];
[controller addURL:[NSURL URLWithString:@"http://mysite"]];
[self presentViewController:controller animated:YES completion:Nil];
[message release];
SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
NSString *output= nil;
switch (result) {
case SLComposeViewControllerResultCancelled:
output= @"Action Cancelled";
NSLog (@"cancelled");
break;
case SLComposeViewControllerResultDone:
output= @"Post Succesfull";
NSLog (@"success");
break;
default:
break;
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Facebook" message:output delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
[alert release];
[controller dismissViewControllerAnimated:YES completion:Nil];
};
controller.completionHandler =myBlock;
}