我正在尝试使用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];
}
}