I must be missing something obvious here... In the past, I've used the following code to post a message to Facebook from my app. The URL assigned via the addURL call in the past has shown up as the URL for the header of the post in Facebook. In the case of the code below, that would provide a link to the app in the app store.
However in Xcode 5, when I try the same thing, it opens the post dialog, then immediately opens whatever is in passed in as the URL. In this case that means it kicks out of my app and into the App Store. The App Store then helpfully informs the user that they've already installed my app... If I then go back to the app, the post dialog is still open, and you can continue posting... but of course kicking the user out in the first place is not exactly what is intended here...
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];
}