1

So I have a share button, and I want to add a link to the shared text which redirects to my game on the App Store, but since my app isn't on the App Store yet I have to somehow generate it programmatically. How do I do that?

    func share() {
    let highscore = UserDefaults.standard.integer(forKey: "highscore")
    let activityVC = UIActivityViewController(activityItems: ["I just scored a new Highscore of \(highscore), can you beat me? /*Here should be the link to the game on the App Store*/"], applicationActivities: nil)
    activityVC.popoverPresentationController?.sourceView = self.view

    self.present(activityVC, animated: true, completion: nil)
}
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Lukas
  • 451
  • 2
  • 13

1 Answers1

2

You can use the ID from iTunesConnect in the link. Just add an entry for your app in iTunesConnect and you can use the ID that iTunesConnect generates for your app in the url. This will allow you to create the link before ever uploading to the App Store.

Here is a link for how to create the url once you have the App Store entry created on iTunesConnect: https://stackoverflow.com/a/2337601/3543861

MSU_Bulldog
  • 3,501
  • 5
  • 37
  • 73
  • thanks for the answer I will try it out, and is there a way to test if the link works? – Lukas Nov 12 '17 at 16:07
  • I'm pretty sure when you click the link it will open the App Store and say something like "App not found" but that means it is working – MSU_Bulldog Nov 12 '17 at 16:11