Link from App to an iTunes artist through button - ios

I'm trying to link to an artists iTunes 'page' through a button on my project. I've tried to use their safari page e.g. "http://itunes.apple.com/au/artist/blink-182/id116851" and it worked once but it only showed their page in safari. I would like to direct them to the artists page on the iTunes store app. I have read other questions and they all seem to be how to link to an app on the app store, but nothing about iTunes store. Here is my code for the button:
-(IBAction)ofwebsite2 {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://itunes.apple.com/au/artist/blink-182/id116851"]];
}
I have tried adding itms:// instead of the http:// but that still didn't work.

Adding itms:// instead of http:// should work as this is the only proper way to do it.
Even if you leave it as http, it should open safari, then redirect to iTunes app.
And please note that this will only work in a device, not in simulator.

Related

iOS 9 Universal Links not launching the app from the same domain

I have setup my AASA JSON file to open the app when someone visits myDomain.com/ShowInTheApp/*
This works from Notes App, Email, Gmail App, Gmail web on safari and basically any other websites other myDomain.com .
When myDomain.com/chooseAppORweb.html contains a link to myDomain.com/ShowInTheApp/ , safari always opens it in the same tab, app wont get launched. I can tap and hold the link to show the context menu that contains an entry "Open In [My app name]" which will indeed launch my app. But not by single tapping on the link.
When I do the exact same steps from another domain, NOTmyDomain.com/chooseAppORweb.html always launches the app without issues.
Has anyone succeeded in launching the app consistently from the same domain using UL ?
Also, if there is an Apple's document that explains any of these behaviours, please share the link.
I'm not sure when Apple added this to their documentation, but it's explained on their Support Universal Links page, in the first note:
In iOS 9 and later, universal links let users open your app when they tap links to your website within WKWebView and UIWebView views and Safari pages, in addition to links that result in a call to openURL:, such as those that occur in Mail, Messages, and other apps.
When a user is browsing your website in Safari and they tap a universal link to a URL in the same domain as the current webpage, iOS respects the user’s most likely intent and opens the link in Safari. If the user taps a universal link to a URL in a different domain, iOS opens the link in your app.
For users who are running versions of iOS earlier than 9.0, tapping a universal link to your website opens the link in Safari.
(Emphasis added)
Essentially, once a user reaches a page hosted on your domain in Safari, any links they follow on your domain will be opened in Safari, even if they're defined as Universal Links by your app.
As st.derrick mentioned above, this is the in-place behavior for Universal links. If you have previously been taken to the App from the link, but then choose to be taken to the website when prompted with a long press, the functionality to open the App will break. You can remedy this by long-pressing again and choosing to open in-app. It's not an ideal solution, but it is the only way I've seen it be fixed. I hope this helps!

swift open link in safari/app store

I have a simple iOS app and I'm in the process of developing a pro version of the app. I will then add a hyperlink to the existing app that will point to the url of the pro app in the app store. So is there any recommended way to do this so when the user taps the link, they will be forwarded to the pro app's page on the app store?
Will the user be redirected to the app store if I simply use this piece of code?
UIApplication.sharedApplication().openURL("http://itunes.apple.com/myappname")
As Far As I know, there's no longer
itms-apps://
instead of the regular http://
so the best way is to use this line of code, watch that I've put it in NSURL because you can't past a simple String. Other than that you can use ! at the end or better way is to use IF LET ...
UIApplication.sharedApplication().openURL(NSURL(string: "https://itunes.apple.com/us/app/24-s-wt-h-plyqzyh-hyhydh-smqry/id897282272?ls=1&mt=8")!)
UIApplication.sharedApplication().openURL(NSURL(string : "itms-apps://itunes.apple.com/app/developerName")!)
With this one I couldn't open my app page on the App Store then I went to my iTunes page on Safari, copied my home page uri and pasted it to related code. And it works perfect!
Just copy your iTunes page on the internet and paste it!

Make a web link open App Store on iOS devices

The question of how to link to a specific app or a list of a specific developers apps from a web link has been answered many times. My issue is that I cannot find a format that works to open the appstore front page, I do not want to link to a specific app I just want the link to open the app store on iOS devices. I have tried http://appstore.com and that works on iPad but on the iPhone I am getting a blank page. Is there a way to open the front page of the app store app from a web link on both iPad and iPhones?
Thy this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"https://itunes.apple.com/en/genre/ios/id36?mt=8"]];
It opens the featured page at iphone (main page).

How to open any iOS App from my own App

What I want to do is open any iOS Application (Evernote, safari, Facebook, etc) from my own iOS application. For example, I have created my app with two simple buttons, the first one is named "Evernote" and the second one is named "Safari", so when I click on the "Evernote" button I want that the Evernote App launch on my iOS device, the same when I click on the "Safari" button I want that the button opens my Safari App. How can I do that? It is that possible? If it is, please tell me how. Thank you very much.
yes it possible if you known this app scheme reference URL.
Example call Tel app:
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"tel://"]]){
NSString *tell = [#"tel://" stringByAppendingString:phoneNumber];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:tell]];
}
Safari and other is same way.
List common schemes Url here : http://wiki.akosma.com/IPhone_URL_Schemes
Hope this link helps you.
http://code.tutsplus.com/tutorials/ios-sdk-working-with-url-schemes--mobile-6629
If you need to open external apps from your app then follow the above link. Or if you need to open the iOS native apps like phone, mail, safari, etc, you can use URL schemes for opening the app.

How to force an iTunes URL to open in Safari on the iPhone?

I have the following URL which links to the product page of a Mac app. I'd like to provide this URL inside my iPhone app. However, it always launches the App Store and subsequently can't display the product because it's not an iOS app. How would I tell it to open in Safari? Is this even possible?
http://itunes.apple.com/us/app/appname/idxxxxxxxxx
Haven't found an answer, so opted for directing to Appshoper URL instead.

Resources