Ios 无法使用SLComposeViewController在Facebook上共享PDF URL
我已经使用social.framework为Tianium Appcelerator创建了共享模块。以下是我的代码:Ios 无法使用SLComposeViewController在Facebook上共享PDF URL,ios,url,facebook-ios-sdk,social-framework,slcomposeviewcontroller,Ios,Url,Facebook Ios Sdk,Social Framework,Slcomposeviewcontroller,我已经使用social.framework为Tianium Appcelerator创建了共享模块。以下是我的代码: - (id) Facebook { //if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) //{ NSLog(@"Sharing via Facebook", nil); SLComposeViewController *fbSheet = [SLCom
- (id) Facebook {
//if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
//{
NSLog(@"Sharing via Facebook", nil);
SLComposeViewController *fbSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[fbSheet setInitialText: [dictPost valueForKey: @"post"]];
[fbSheet addURL: [NSURL URLWithString: [dictPost valueForKey: @"link"]]];
NSLog(@"Sharing via Facebook 2", nil);
[[TiApp app] showModalController: fbSheet animated: YES];
NSLog(@"Sharing via Facebook 3", nil);
/*} else {
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Facebook" message:@"Post can't be shared. Please check Settings." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil] autorelease];
[alert show];
}*/
}
- (id) Tweet {
SLComposeViewController *tweetSheet = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeTwitter];
[tweetSheet setInitialText: [dictPost valueForKey: @"post"]];
[[TiApp app] showModalController: tweetSheet animated: YES];
}
- (void) SharePost : (id) args {
ENSURE_UI_THREAD(SharePost, args);
ENSURE_UI_THREAD(Tweet, nil);
ENSURE_UI_THREAD(Facebook, nil);
NSArray *val = args;
NSDictionary *dict = [[val objectAtIndex: 0] retain];
dictPost = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects: [dict valueForKey: @"post"], [dict valueForKey: @"link"], [dict valueForKey: @"title"], [dict valueForKey: @"image"], nil] forKeys: [NSArray arrayWithObjects: @"post", @"link", @"title", @"image", nil]];
if ([[dict valueForKey: @"type"] intValue] == 1) {
[self Tweet];
} else if ([[dict valueForKey: @"type"] intValue] == 2) {
[self Facebook];
}
}
我只需要给SharePost打个电话,它就能做所有的事情。这是Twitter和Facebook上共享的唯一代码。但当我在Facebook上共享一些URL时,对话框会正确显示,当我选择POST时,大约5秒钟后就会出现错误。出现以下错误
无法发布到Facebook-无法发送帖子,因为与Facebook的连接失败
从该错误中,当选择“重试”时,可以成功发布相同的错误。
我在这里附上了截图
如果有人有任何线索,请告诉我。只有在共享其他HTML的PDF url或视频url时才会出现错误,等等,效果非常好。您有什么解决方案吗?对于PPTX URL,我也面临同样的问题。但不是所有的URL,有些是PPTX URL,有些不是。不。。我已经在苹果的网站上注册了这个漏洞。