如果你只想在iOS版6.0共享的东西,所以你使用的社会和帐户框架,并使用下面的代码
-(void)facebook_Share_in_IOS6.0{
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) //check if Facebook Account is linked
{
mySLComposerSheet = [[SLComposeViewController alloc] init]; //initiate the Social Controller
mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; //Tell him with what social plattform to use it, e.g. facebook or twitter
[mySLComposerSheet setInitialText:[NSString stringWithFormat:@"Test",mySLComposerSheet.serviceType]]; //the message you want to post
// [mySLComposerSheet addImage:yourimage];
[self presentViewController:mySLComposerSheet animated:YES completion:nil];
}else{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Attention" message:@"First Set your facebook account. To post your answer to facebook" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
[mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) {
NSString *output;
switch (result) {
case SLComposeViewControllerResultCancelled:
output = @"Action Cancelled";
break;
case SLComposeViewControllerResultDone:
output = @"Post Successfull";
break;
default:
break;
} //check if everything worked properly. Give out a message on the state.
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Facebook" message:output delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}];
}
通过iPhone内部登录胜任的问题可能是你有在SBJson库的版本。看看这个类似的问题:http://facebook.stackoverflow.com/questions/12301617/application-crash-on-login-in-ios-facebook-sdk-3-0 – borisdiakur