★ TouchArcade needs your help. Click here to support us on Patreon.

Opening the app store from a game

03-23-2010, 04:13 AM
#1
Joined: Jan 2009
Location: Christchurch, New Zealand
Posts: 515
Opening the app store from a game

I'm trying to improve the code for my "More Games" button

I am trying to get it to open the app store on the ipod with a search for my name (and thus all my games).

right now I have code that looks like this:

NSURL *url = [NSURL URLWithString:@"http://itunes.com/apps/shenmansell"];

[[UIApplication sharedApplication] openURL:url];

That works, but first it quits the app, then opens safari, then closes safari and opens iTunes, then closes iTunes and opens the app store.

Is there a way to get the app store to load directly?

Any help is greatly appreciated
Shen
03-23-2010, 04:27 AM
#2
The easiest way to do this without exiting the game would be to use UIWebView, and then point it to a webpage of your own design. This will allow you to update and change the page anytime you like.

If a person decides to purchase, they can click a link (icon) and the game will exit and take them to the App Store. As far as I know, there isn't a single-click solution for this (allowing the purchase of a different game).

This essentially runs Safari within your game without exiting the game. Last I heard, UIWebView is still a resource hog (about 9-10 megs), so be careful that you don't run out of memory.

A ragdoll physics platformer:Flickitty
The artist: randall schleufer
Twitter: @FlickittyiPhone

03-23-2010, 04:30 AM
#3
Joined: Jul 2009
Location: Melbourne, Australia
Posts: 2,585
I have no idea, but as a consumer I must warn you against that.

I get really frustrated when an app quits itself because I clicked a link, often accidentally, if I press a more games button, I expect to be taken to a different menu, ala Plants vs. Zombies. At least make a popup window informing users that continuing will exit the app.

Games I have beta tested: Minigore, Cogs, Guerilla Bob, Above and Beyond: Air Combat, Baseball Superstars 2010, 33rd Division, Cash Machine, 5 star General, Flick Football... Possibly some other ones I;ve forgotten
03-23-2010, 04:35 AM
#5
Joined: Jan 2009
Location: Christchurch, New Zealand
Posts: 515
Flickitty: I'm a little bit worried about pointing to a webpage on my own server, since my game has won the free lottery, and had about 1.2 million downloads over the last week.

I wouldn't want to "slashdot" my own server.

Sadly after this happened I figured out that my current "more games" code was only working 10% of the time, and normally just opens users into the app store without actually bringing up any of my games.

Hmar9333: Thanks for the input.
03-23-2010, 04:36 AM
#6
use this:

itms://itunes.com/apps/shenmansell
03-23-2010, 04:40 AM
#7
Joined: Jan 2009
Location: Christchurch, New Zealand
Posts: 515
Carlos: I've been looking at the Q+A, and it looks like the listing 2 should be what I need, however I haven't been able to get it to work in my own code.

The second function just ends up getting null for the request and response,
and the connectionDidFinishLoading never gets called.

In my new code I'm currently using a link like at the bottom of http://bjango.com/articles/ituneslinks/ , however it is the one that opens safari and itunes before it opens the app store.
03-23-2010, 04:49 AM
#8
Joined: Jan 2009
Location: Christchurch, New Zealand
Posts: 515
MrBlue: that gets rid of safari, but itunes still opens before the app store.

I've just noticed that that style link - itms://itunes.com/apps/shenmansell has the same problem that my old link had.

If the user had previously left the app store after doing a search and the main display is an app from that search, then opening the store with the link above will just redisplay the app from the last session, and not show the new search.

It looks like I may have to serve my own web pages after all, or some variation on that theme :-p
03-23-2010, 04:55 AM
#9
Joined: Mar 2009
Location: Singapore
Posts: 1,770
Send a message via AIM to kohjingyu
I think if you replace itunes with phobos it works.

Like:

http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=327077492&mt=8

Will open Safari, close Safari and open the App Store.

http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=327077492&mt=8

Will just open the app store.
03-23-2010, 05:14 AM
#10
Joined: Jan 2009
Location: Christchurch, New Zealand
Posts: 515
This works for linking directly to an app, and it works great for a "Buy now" button that is up selling a lite version.

It doesn't work with opening a link to all my games though, as the iPhone has some technical bug that stops artist links from working.

Quote:
Originally Posted by kohjingyu View Post
I think if you replace itunes with phobos it works.

Like:

http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=327077492&mt=8

Will open Safari, close Safari and open the App Store.

http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=327077492&mt=8

Will just open the app store.