-(IBAction)post:(id)sender
{
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
mySocialComposer = [[SLComposeViewController alloc]init];
mySocialComposer = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeFacebook];
[mySocialComposer setInitialText:@"Hello World"];
[mySocialComposer addImage:[IIImage imageNamed:@"myImage.png"]];
[self presentViewController:mySocialComposer animated:YES completion:nil];
}
[mySocialComposer setCompletionHandler:^(SLComposeViewControllerResult result){
NSString *outout = [[NSString alloc] init];
switch (result) {
case SLComposeViewControllerResultCancelled:
outout = @"Post Cancled";
break;
case SLComposeViewControllerResultDone:
outout = @"Post Done";
default:
break;
}
UIAlertView *myalertView = [[UIAlertView alloc]initWithTitle:@"FaceBook"
message:outout delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[myalertView show];
}];
}
我希望在Facebook上发布一些没有图片的内容,但当我尝试用图片发布时,却出现错误提示。而当我在帖子中添加了图片时,则可以成功发布。但我只想发布没有图片的内容。有没有什么方法可以做到这一点?