Iphone app links to app store but shows blank page instead of app to download - iphone

I´m making an app on iphone and i have a button that links to the appStore in order to download another app.
I´m using the code below that opens safari and instead of showing the twitter app the his on the link, show a blank page.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://itunes.apple.com/us/app/twitter/id333903271?mt=8"]];
Anyone knows how to solve this?

Was using the simulator, it doesn´t have a app store so offcourse it wouldn´t show it... Guessing it will show on a real device.

Related

Safari App takes user to Settings App in iPhone in iOS 6. How can this be done in my iPhone app?

I had a requirement to redirect a user to the iOS Settings application from within my application. I know that in iOS 5, we could use the following URL scheme to achieve this: prefs:root=General.
And I could use the following line of code:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=General"]]
But Apple no longer supports this open URL scheme since the iOS 5.1 update.
But recently I have noticed that, in the Appstore app and Safari browser etc, Apple let this happen.Please refer to the attached image where Apple shows the alert. And on clicking the Settings button, user is taken to the Settings app. Any idea, how this is done. I believe if this can be done in App Store application, there should be some way that I can do it in my application also. Please comment if someone has a fix, or more idea on how this can be done.

How to open “Paid” app page in iPhone's AppStore by clicking button in “Lite” app?

I have 2 versions of an app. Lite and Paid. I want to have a button in Lite version which when clicked opens App Store application on iPhone and shows the page for Paid version of the app.
How do I do this? I DONT want to open Paid version iTunes page in Safari. It should open in App Store application only.
This is a bad solution. iPhone opens Safari first, then AppStore.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"itms://itunes.apple.com/us/app/YOUR APP ID NO."]];
Protocol itms-apps:// solves problem. Only AppStore opens.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"itms-apps://itunes.apple.com/us/app/YOUR APP ID NO."]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://itunes.apple.com/{yourCountryCode}/app/idXXXXXXXXX"]];
where XXXXXXXXX is your app id
i think it doesnt get better than this.
EDIT: This link also doesn't know more and is pretty good from what i know: http://wiki.akosma.com/IPhone_URL_Schemes#App_Store

Problem with iPhone URL Schemes for launching app and Mobile Safari - I'm getting stuck in a loop!

Need some help with iPhone development here....
I made a custom URL scheme for my app. It allows other apps, as well as Mobile Safari, to launch my app. It looks somewhat like this:
myapp://
This will launch "myapp". If I type that into Mobile Safari, my app launches.
I've created a website that, in the end, redirects to myapp:// and launches the app. The problem is that now every time I open Mobile Safari manually, my app automatically gets launched. It's stuck. I have to kill the windows quickly in Mobile Safari, or kill Safari in the task manager, in order for this looping to stop.
Does anyone have a solution to this? Even if I do the following:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://www.newurl.com/"]];
It opened Mobile Safari, and then opens the URL I want to go to, but for some reason if my redirect page is still open somewhere in the background it just relaunches my app again.
Thanks.
The issue, I think, is that mobile safari is trying to load myapp:// whenever the browser itself is opened (because it is trying to load the corresponding tab). A solution might be to programmatically close the browsing tab once you have been redirected your app- that way the page does not stay in mobile safari, redirecting you every time you open the browser.

How Can I open another App from my app?

I have rediATM app installed on my iphone. rediATM app is free on itunes.
I want to open that app from my iphone app.
I am not able to find out the way to open it.
i am using the following code to open it but it takes me to the website.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://itunes.apple.com/au/app/rediatm-finder/id358936470?mt=8"]];
Please help.
It does not work because you are opening the download link for itunes.
If you want to open another app on your iPhone with your own app, you must find out if this app provides a custom URL scheme. If they do, you could open the app using that custom URL, but otherwise not.
Here is an example how to create a custom URL scheme for your own app Launching Your iPhone App Via Custom URL Scheme and Apple's documentation: Communicating with Other Apps

Attach XCode Debugger

I'm developing an iPhone app that needs a web login.
As usual I call
[[UIApplication sharedApplication] openURL:loginURL];
This close the app and calls the login page inside Safari.
Once logged, the app is opened once again using a callback address and the iPhone URL registration feature.
The question here is:
Since the app is closed when I call Safari, the debug stops. How can I continue the debug?
Thanks
You can, however, get XCode to connect to an application the next time it's launched. You bring up the inspector on your executable and check the "Wait for next launch/push notification" box. This is explained in more detail here.
The other alternative would be to use a UIWebView inside your app rather than switching to Safari.