Permalink
Browse files

Merge pull request #1334 from Nezz/ios_storelink

Use generic link for opening store on iOS
  • Loading branch information...
2 parents 27bc1a2 + ead3f4b commit 4ff41d4aabe010b3d1f5586412147922d1bf099d @tomspilman tomspilman committed Feb 13, 2013
Showing with 16 additions and 3 deletions.
  1. +16 −3 MonoGame.Framework/iOS/GamerServices/Guide.cs
@@ -333,10 +333,23 @@ public static Nullable<int> EndShowMessageBox (IAsyncResult result)
public static void ShowMarketplace (PlayerIndex player)
{
- AssertInitialised ();
+ AssertInitialised();
+
+ string bundleName = NSBundle.MainBundle.InfoDictionary[new NSString("CFBundleName")].ToString();
+ StringBuilder output = new StringBuilder();
+ foreach (char c in bundleName)
+ {
+ // Ampersand gets converted to "and"!!
+ if (c == '&')
+ output.Append("and");
- NSUrl url = new NSUrl("http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=306469222&mt=8");
- if (!UIApplication.SharedApplication.OpenUrl(url)) {
+ // All alphanumeric characters are added
+ if (char.IsLetterOrDigit(c))
+ output.Append(c);
+ }
+ NSUrl url = new NSUrl("itms-apps://itunes.com/app/" + output.ToString());
+ if (!UIApplication.SharedApplication.OpenUrl(url))
+ {
// Error
}
}

0 comments on commit 4ff41d4

Please sign in to comment.