有人让 [FBDialogs canPresentShareDialogWithParams:nil] 正常工作吗?它总是给我不。我应该在 params 中放什么?
if ([FBDialogs canPresentShareDialogWithParams:nil]) {
NSURL* url = [NSURL URLWithString:@"http://www.google.fr"];
[FBDialogs presentShareDialogWithLink:url
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
NSLog(@"Error: %@", error.description);
} else {
NSLog(@"Success!");
}
}];
} else {
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *fbComposer = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[fbComposer setInitialText:@"Google rocks !"];
[self presentViewController:fbComposer animated:YES completion:nil];
} else {
[[[UIAlertView alloc] initWithTitle:@"Informations" message:@"You have to be registered into the settings of your phone in order to share" delegate:nil cancelButtonTitle:@"Close" otherButtonTitles:nil] show];
}
}