How do I link to another app in the App Store in an iPhone app? - iphone

I used this technique, but it appears to not work anymore in 3.0. In the simulator at least, my app opens Safari, and then there is a visible redirect, but then I get a message that there has been too many redirects. Any fix?

Have you tried this on the device? There is no App Store application on the Simulator, so any attempts to redirect to it will fail.
Within my application, the itunes.apple.com links for the App Store work just fine under 3.0 on the actual devices.

I can't test this right now, but have you tried changing the 'http:' protocol in the link to 'itms:' instead?

Related

FBSDK share kit iOS9 issue between device and simulator

I've upgraded FBSDK in my app to the recent version to support iOS9 and included all the LSApplicationQueriesSchemes schemes and NSAppTransportSecurity. Everything works fine including login and sharing.
But when I try to perform a share, the device brings up a sharing dialog, which is a SLComposeView whereas the simulator pops up the safari from the bottom to show a native facebook dialog. I am really not sure whats causing this difference in the share dialog. Is there something i am missing. Login dialog works fine as expected (Safari popup in both simulator and device). I'm attaching pics for understanding.
Answering my own question.
I fixed the problem by subclassing the native FBSDKShareButton. Now the behavior looks fine.

URL scheme in iOS

I have added an URL scheme to my application. The URL scheme is testapp://. While I entered the text testapp:// in Safari and on hitting return, it launched my application.
Then I tested with testapp://placeid=12. This is launching the TestApp in iPad but in iPhone, I am getting Cannot Open Page and I am not able to test.
I could pass the placeid=12 as URL query. But what I would like to know is, why it is not opening in iPhone alone.
Any idea on this?
Note: Irrespective of device types, it seems to be iOS issue. This is the behaviour from iOS 6 and above.
Could it be that each device is running a different iOS version?
If so, please take into account some details depending on the version. For example, if you read the Advanced App Tricks, there is a section that may help you:
Handling URL Requests
An app that has its own custom URL scheme must be able to handle URLs passed to it. All URLs are passed to your app delegate, either at launch time or while your app is running or in the background. To handle incoming URLs, your delegate should implement the following methods:
Use the application:willFinishLaunchingWithOptions: and application:didFinishLaunchingWithOptions: methods to retrieve information about the URL and decide whether you want to open it. If either method returns NO, your app’s URL handling code is not called.
In iOS 4.2 and later, use the application:openURL:sourceApplication:annotation: method to open the file.
In iOS 4.1 and earlier, use the application:handleOpenURL: method to open the file.
Hope this helps. Otherwise, I will really recommend you to stick to the standards. It would make your life easier :)
It is possibly not working because testapp://placeid=12 is not a valid URL. You will need a domain address there too, like testapp://localhost/query?placeid=12. It is possible the '=' character is causing the error.
I am not able to test it right now so let me know.
As mentioned in the question's note, it is iOS 6's Safari browser behaviour. We could not have "=" in the host of the URL while entering in Safari.
Instead, I solved this problem in the following manner.
Sent the URL in mail, and from Mail, if I click the URL, the app was launched. But the important point is, I had to parse the URL host to get the value.

iTunes app link cannot open page in safari in simulator and also iDevices

I hope this may be duplicate question. But none of the answers didn't hard help me. I am trying to open a link from my iOS application. When I press the button, It opens the safari app and it always says an alert "Safari cannot open the page because the address is invalid". Here it is a link looks like the same https://itunes.apple.com/gb/app/app_name/id(appId) .
I don't think it is a good place to post the exact the app link. So the above link is dummy link exactly look like mine. Why the error always happening when I try to open the link. I tried in simulator and also in iPod. Same error occurs. If I try the same link with Safari in MAC OS then it works.
Here it is a code I am using to open the safari from my app with a link.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"https://itunes.apple.com/gb/app/app_name/id(appId)"]];
I am from India. The above link contains gb. Is that link can only open from Great Britain??
UPDATE:
I have good working network. And I tried one more thing. I opened my safari app in simulator and search my app in google and clicking that link shows the same error. Is that a problem with that link in apple side itself??
Kjuly's answer is 90% correct (and +1 to Kjuly!).
If you look at the at the Appirater code,
and in the .m file that has the function that opens up the app store (it's the "rateApp:" method) I see this bit of code:
+ (void)rateApp {
#if TARGET_IPHONE_SIMULATOR
NSLog(#"APPIRATER NOTE: iTunes App Store is not supported on the iOS simulator. Unable to open App Store page.");
#else
So no matter what you try, you are not going to be able to open the App Store app within the simulator. The App Store app does not exist in the simulator, so that's why you get a "not found" error when your web view attempts to redirect to it. This should work fine on the actual device that has the App Store app installed.
Take a try with this URL:
http://itunes.apple.com/app/<appId>
Note: Replace <appId> with your desire App's ID, e.g. id543028543.
That is a possibility as you are specifying the region to which the app belongs or is hosted on the app store under. Try loading the the url without the region 'gb'.
I was having same problem. Links in email not opening, links to App Store not working and App Store not searching or loading apps. I called Appke support. A reset worked! Go to settings to find how the reset under general. It doesn't delete anything either.

Access the Apps available in iphone

Hi i would like to access the apps which are available in iphone means downloaded apps and inbuild apps.But here issue is if i access any app which is available in iphone using [[UIapplication sharedapplication]openurl:[NSURl url urlwithstring:#"http://www.skype.com"]] like this i can able to access that iphone app succesfully but if i want to come back to my app i did not find any way only i have to hit homebutton. So is there anyway to come back to my app at any point of time. if anyone know please let me know. Thanking you.
So is there anyway to come back to my app at any point of time.
Not unless the other app supports returning back to the calling app (by responding to a special specifier in the URL, for example).
Note that there is also -[UIApplication canOpenURL:] which will tell you if a particular URL scheme is supported. This is useful to check whether a particular app is installed without attempting to launch it.
That is default behavior of the iOS application. Once your application is in background there is no way to come back to your application programatically.
User has to manually open your application.
You can navigate to some other apps on the phone using the URL method, however you cannot return to your app.
Once you navigate to the other app, it takes over and your app is no longer running. Therefore, the other app would need to navigate back to you. That obviously is not possible, unless you had access to the code of the other app.

iPhone application reset

I have a strange problem with my iPhone app.
I use geolocation and push notification. Everything is ok, but I want to test from scratch on the iPhone (connected to xcode debugger)... and I can't re initialized the iPhone.
I explain: I remove the app from the iPhone, and after re-installing the app (with xcode or with iTunes), I launch the app, but iOS doesn't ask me to approve geolocation and push notification as it does the first time. In fact, it seems to 'remember' my choices.
As I need to debug this (Some users have problem on running app the first time), I'm blocked.
Thanks by advance for yours answers
There's a place in the Settings app to reset Location permissions.