4

我正在尝试使用 SLComposeViewController setInitialText 从我的应用程序创建 Facebook 帖子。我还想在帖子中标记组织的页面。

结果会是这样的:Having fun with @Cool Org

由于空间的原因,我无法让标签正常工作,就好像组织名称是两个单独的标记一样。

有什么方法可以使用 SLComposeViewController setInitialText 并标记名称中有空格的页面?

我尝试了几种方法都无济于事。

- (IBAction)touchedFacebook:(id)sender {
SLComposeViewController *mySLComposerSheet;
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) 
{
    mySLComposerSheet = [[SLComposeViewController alloc] init]; 
    mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; 

    //plain title
    //[mySLComposerSheet setInitialText:[NSString stringWithFormat:@"Having fun at %@ with @Cool Org!", _linkInfo.linkName]];

    //spaces encoded
    //[mySLComposerSheet setInitialText:[NSString stringWithFormat:@"Having fun at %@ with @Cool%20Org!", _linkInfo.linkName]]; 

    //escaped double quotes
    //[mySLComposerSheet setInitialText:[NSString stringWithFormat:@"Having fun at %@ with @\"Cool Org\"!", _linkInfo.linkName]];

    //page id
    //[mySLComposerSheet setInitialText:[NSString stringWithFormat:@"Having fun at %@ with @1234!", _linkInfo.linkName]];

    //page id in brackets
    [mySLComposerSheet setInitialText:[NSString stringWithFormat:@"Having fun at %@ with @[1234]!", _linkInfo.linkName]];


    [self presentViewController:mySLComposerSheet animated:YES completion:nil];
}

}

4

0 回答 0