我刚刚通过 ios 6 将 facebook 集成到我的应用程序中,但是在我的墙上发帖时遇到了问题。它只是说“通过 ios 应用程序发布”。我想让它说“通过应用名称发布”。我已经在 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;
}