Skip to content

Loading…

Use generic link for opening store on iOS #1334

Merged
merged 3 commits into from

5 participants

@Nezz

This doesn't need too many comments.

@mgbot

Can one of the admins verify this patch?

@tomspilman
Mono Project member

This is less crappy that what was there, but still not an acceptable solution.

We should probably expose a property like Guide.MarketplaceLinkUrl and throw an exception if it is left unset.

@Aranda

You can do this on iOS without an explicit link. I've have some code in my fork of @slygamer 's monogame-support that does this. I've not gotten around to making a PR yet as I haven't had a chance to test it thoroughly:

NSUrl appStoreUrl = new NSUrl("itms-apps://itunes.com/app/" + ContentIdHelper.GetCurrentContentIdentifier());
UIApplication.SharedApplication.OpenUrl(appStoreUrl);

and

https://github.com/Aranda/MonoGame-Support/blob/ios_vibration_and_tasks/Microsoft.Devices/iOS/Phone/Tasks/ContentIdHelper.cs

The only testing it's had so far is using an itms link in a web browser, eg itms://itunes.com/app/smashingplanets

@tomspilman
Mono Project member

@Nezz

Do you want to try Aranda's method? Copy those helpers into the ShowMarketplace() and test it with your game?

If not maybe @RayBatts can give it a try here and submit another pull request for it.

@Nezz

I checked it and it works fine. I will update this PR soon with it :)

@Nezz

@mgbot test

@Aranda Aranda commented on an outdated diff
MonoGame.Framework/iOS/GamerServices/Guide.cs
@@ -336,10 +336,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 input)
@Aranda
Aranda added a note

Shouldn't input be be bundleName here (or vice versa)? Looks like input is currently undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Aranda

@Nezz, is MGBot working for you? I'm not seeing the build information under the PR description like normal, or the little green dots for built commits.

@tomspilman @dellis1972 Does Nezz need to be added as an admin?

@Nezz

Thanks for noticing. I have to admit I was too lazy to boot into mac to check this :$

There seems to be a user called bloodsource which resembles my email address, but MGBot doesn't seem to be listening to me.

@dellis1972
@tomspilman
Mono Project member

Very cool. Looks good to me... but I haven't tested it yet.

@Nezz

I have tested it and it works fine. I tried it with http too, but it was a bit unreliable.
Actually I'm surprised that this works since app names aren't unique, unlike in Windows 8 Store.

@tomspilman
Mono Project member

Actually I'm surprised that this works since app names aren't unique, unlike in Windows 8 Store.

Actually I think the are. http://www.hemispheregames.com/2010/12/18/the-russian/

@Nezz

They are unique per region only.
We had trouble with iTunes Connect because we wanted to reserve the app when we started working on the project. To do so, we created a dummy submission containing only the required details. When we were ready to submit the app, we had to change some of the details, but it was not possible. We did what most people do: delete the original submission and create a new one, but as it turned out once you delete an app, you can never use the same name again (it stays reserved but only for you, not others). We ended up submitting the game as UK store native, while hd/free versions remained US.
The fun part: After two months of debate with the iTunes staff, they agreed to restore the deleted app, so now we have to apps of the same name.
Rum Run

@tomspilman
Mono Project member

That all sounds like total madness. Luckily we just got our trademark for "ARMED!" which i hope helps in such disputes.

@Nezz

That will only help if you are not in a rush and have 2 to 3 months to let them sort it out.

@tomspilman
Mono Project member

So we good to merge this?

@Nezz

I don't think there is anyone else actively working with iOS, so yes :)

@tomspilman
Mono Project member

I'm good with merging it... it cannot be worse than the hardcoded link to the wrong product.

@tomspilman tomspilman merged commit 4ff41d4 into mono:develop3d

1 check passed

Details default Merged build finished.
@Nezz Nezz deleted the Nezz:ios_storelink branch
This was referenced
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 9, 2013
  1. @Nezz
Commits on Feb 12, 2013
  1. @Nezz
  2. @Nezz

    Whoops

    Nezz committed
Showing with 16 additions and 3 deletions.
  1. +16 −3 MonoGame.Framework/iOS/GamerServices/Guide.cs
View
19 MonoGame.Framework/iOS/GamerServices/Guide.cs
@@ -336,10 +336,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
}
}
Something went wrong with that request. Please try again.