你試過這個嗎?
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
if (result == SLComposeViewControllerResultCancelled) {
NSLog(@"ResultCancelled");
} else
{
NSLog(@"ResultSuccess");
}
[controller dismissViewControllerAnimated:YES completion:Nil];
};
controller.completionHandler =myBlock;
[controller setInitialText:@"Learn iOS6 Social Framework integration"];
[controller addURL:[NSURL URLWithString:@"http://google.com"]];
[controller addImage:[UIImage imageNamed:@"myimage.jpeg"]];
[self presentViewController:controller animated:YES completion:Nil];
}
else{
//NSLog(@"UnAvailable");
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Facebook"
message:[NSStringstringWithFormat:@"The application cannot post message at the moment. Please login under setting section with your Facebook account."]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
你想使用蘋果提供的原生框架嗎? –
我可以那樣做,是的。我一直在試圖瞭解Facebook的,但我會接受使用蘋果的框架。 – Scuttle
有沒有人有使用Facebook框架的例子? – Scuttle