繁体   English   中英

iOS6本机Facebook分享对话框网址

[英]iOS6 native facebook share dialog url

我使用了本机发布对话框,并向实际显示该对话框的方法传递了一个URL,该URL实际上已根据需要发布到了Facebook,但我不希望此URL显示在发布对话框中,因为如果用户修改了我的错误,然后发布了一些错误的文本。无论如何,URL是否一直隐藏在对话框中。 我正在使用方法presentShareDialogModallyFrom:initialText:image:url:handler:呈现本机帖子对话框。

不幸的是,您没有显示任何代码,因此我们不知道您如何传递URL。 您可能使用setInitialText:方法,而您需要addURL:方法。

SLComposeViewController *facebookController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[facebookController setInitialText:self.titel];
[facebookController addURL:[NSURL URLWithString:self.guid]];

[self presentViewController:facebookController animated:YES completion:nil];

Facebook本机共享,您必须在应用程序中实现Accounts Framework

在框架中,您必须添加: Social.framework

在您的文件.h中添加:

#import "Social/Social.h"

    @interface UIViewController {

    SLComposeViewController *FBCompose;

    }

IBAction下的.m文件中,添加:

- (IBAction)facebook:(id)sender {

    NSData* imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:@"imageURL"]];
    UIImage* image = [[UIImage alloc] initWithData:imageData];

    //----here you can get pragmaticaly a part of yout text
    NSString *mutableArry = (self.myMutableDictionay)[@"string"];

    FBCompose = [[SLComposeViewController alloc]init];
    FBCompose = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
    [FBCompose setInitialText:[NSString stringWithFormat:@"Ishare on FB %@  from MyApp App", mutableArry]];
    [FBCompose addImage:image];
    [FBCompose addURL:[NSURL URLWithString:@"http://Link of my app or get the link by myMutableDictionay"]];

    [self presentViewController:FBCompose animated:YES completion:NULL];

}

编辑我的帖子,因为不完整,对不起。

希望这对您有所帮助;)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM