0

我必须在这里遗漏一些明显的东西......过去,我使用以下代码从我的应用程序向 Facebook 发布消息。过去通过 addURL 调用分配的 URL 已显示为 Facebook 中帖子标题的 URL。对于下面的代码,这将提供指向应用商店中应用的链接。

但是在 Xcode 5 中,当我尝试相同的操作时,它会打开帖子对话框,然后立即打开作为 URL 传入的任何内容。在这种情况下,这意味着它会退出我的应用程序并进入 App Store。然后 App Store 会帮助用户通知他们已经安装了我的应用程序...如果我然后返回应用程序,帖子对话框仍然打开,您可以继续发帖...但当然会踢出用户首先,这并不完全是这里的意图......

if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) //check if Facebook Account is linked
{
    SLComposeViewController *mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; //Tell him with what social plattform to use it, e.g. facebook or twitter
    NSString *body = @"";
    for (SpelledWord *thisWord in wordList) {
        body = [NSString stringWithFormat:@"%@%@\n", body, thisWord.word];
    }
    if ([[GameState sharedGameState] gameRunState] == kUserPaused) {
        [mySLComposerSheet setInitialText:[NSString stringWithFormat:@"I'm Playing String Theory: a Word Game\n\nWord List so Far:\n%@",body]]; //the message you want to post
    } else {
        [mySLComposerSheet setInitialText:[NSString stringWithFormat:@"I just played String Theory: a Word Game and got a score of %i\n\nFinal Word List:\n%@",[GameState sharedGameState].score,body]]; //the message you want to post
    }

    [mySLComposerSheet addURL:[NSURL URLWithString:deepLinkStoreBitly]];
    [self presentViewController:mySLComposerSheet animated:YES completion:nil];
}
4

0 回答 0