2013-07-03 118 views
0

我已经使用了原生的帖子对话框,并将URL传递给实际显示对话框的方法。实际上,URL根据需要发布到Facebook。但我不想要此URL在后期对话框中显示,因为如果用户修改它,那么我的错误就会发布一些错误的文本。无论如何,都会在对话框中隐藏URL。我使用的方法presentShareDialogModallyFrom:initialText:image:url:handler:提供本地发布对话框。iOS6原生facebook共享对话框url

+0

你是否将URL作为'NSURL'传递? – rckoenes

+0

是的,它是一个NSURL对象。 –

回答

0

不幸的是,你不显示任何代码,所以我们不知道你是如何通过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]; 
+0

我使用的方法+(BOOL)presentShareDialogModallyFrom:(的UIViewController *)的viewController initialText:(的NSString *)initialText 图像:(的UIImage *)图像 URL:(NSURL *)的url 处理程序:(FBShareDialogHandler)处理; 以呈现原生帖子对话框 –

+0

您不应该。使用iOS 6中Apple提供的这一个。 – yoeriboven

+0

我使用了同样的东西,但url仍然显示在发布对话框中。 –

-2

Facebook的本地股,你必须在你的应用程序

在你framwork来实现Accounts Framework你必须添加:Social.framework

在文件中添加.H:

#import "Social/Social.h" 

    @interface UIViewController { 

    SLComposeViewController *FBCompose; 

    } 

在您的档案.m下的IBAction加:

- (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]; 

} 

编辑我的帖子,因为是不完整的抱歉。

希望这对你有帮助;)

+0

什么是FBCompose?这应该是SLComposeViewController的一个对象。那是什么奇怪的'mutableArry'? – yoeriboven

+0

是您的.h文件中的SLComposeViewController – BlackSheep

+0

编辑我的文章,对不完整的代码之前和worg来回MutabalArray是MutableDictionary(但这是可选的,你可以得到一个strig你想要的) – BlackSheep

相关问题