用于iOS 6.0的Facebook SDK本机共享对话框
我在iOS应用程序中加入了Facebook本机共享对话框,让用户共享一些数据。问题是,对话框没有打开。这是代码。另外,我将图像的URL传递给该方法是正常的吗?也许,这就是问题所在用于iOS 6.0的Facebook SDK本机共享对话框,ios,facebook,share,Ios,Facebook,Share,我在iOS应用程序中加入了Facebook本机共享对话框,让用户共享一些数据。问题是,对话框没有打开。这是代码。另外,我将图像的URL传递给该方法是正常的吗?也许,这就是问题所在 BOOL displayedNativeDialog = [FBNativeDialogs presentShareDialogModallyFrom:self initialText:activityName image:ac
BOOL displayedNativeDialog =
[FBNativeDialogs
presentShareDialogModallyFrom:self
initialText:activityName
image:activityImageURL
url:activityURL
handler:^(FBNativeDialogResult result, NSError *error) {
if (error) {
NSLOG(@"Error occured");
} else {
if (result == FBNativeDialogResultSucceeded) {
NSLOG(@"Success");
} else {
NSLOG(@"No success");
}
}
}];
if (!displayedNativeDialog) {
NSLOG("Window does notdisplayed");
}
而不是
图像:activityImageURL
将UIImage数据传递给image
image:[UIImage imageWithNamed:@“blahblah”]只有当用户安装了Facebook应用程序时,才能使用本机对话框。首先检查facebook应用程序是否可用,然后相应地显示本机对话框或web对话框:
FBShareDialogParams *shareParams = [[FBShareDialogParams alloc] init];
shareParams.link = [NSURL URLWithString:@"http://some-url.com"];
shareParams.name = @"Post Name";
shareParams.picture= [NSURL URLWithString:someImageURL];
shareParams.description = @"Post Description";
if ([FBDialogs canPresentShareDialogWithParams:shareParams])
{
[FBDialogs presentShareDialogWithParams:shareParams
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
NSLog(@"%@", [error localizedDescription]);
}];
}
else
{
NSDictionary *params = @{
@"name" : shareParams.name,
@"description" : shareParams.description,
@"picture" : objectiveCharacterImageURL,
@"link" : linkURL
};
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
}];
}
你可以通过nil而不是图片URL来测试你的图片问题。另外,您是否通过iOS 6设置登录到Facebook系统帐户?