how to open itunes link in iphone app?
12,988
Solution 1
First copy the url from iTunes which you want to open in app.
Then use below code:
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:@"http://itunes.apple.com/in/album/carnatic-vocal-sanjay-subrahmanyan/id106924807?ign-mpt=uo%3D4"]];
here, URLWithString value will be your app url which you want to open.
Let me know in case of any difficulty.
Solution 2
Use the itms-apps://
prefix to open in iTunes, e.g.
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=409954448"]];
Solution 3
It will work only with device. Throws Request could not be completed on simulator.
Author by
Senthilkumar
Updated on July 01, 2022Comments
-
Senthilkumar almost 2 years
I am trying to open itunes link on
UIControlEventTouchDown
button press event. My code is as follows.NSString *urlString =@"http://itunes.apple.com/in/album/carnatic-vocal-sanjay-subrahmanyan/id106924807?ign-mpt=uo%3D4"; NSString *str_ur=[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSURL *url=[NSURL URLWithString:str_ur]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [webview_buy loadRequest:requestObj]; webview_buy.delegate=self; [self.view addSubview:webview_buy];
This will go to itunes in the device and open the itunes store. But i get an alert message that says
Your Request could not be Completed.
Please give idea with code.
-
Senthilkumar almost 13 yearsI used this method also,but i have same alert message Your Request could not be completed.
-
Senthilkumar almost 13 yearsI used this method also,but i had same alert message Your Request could not be completed.
-
Nishant B almost 13 yearsMake sure below things: (1) app must be live in app store. (2) You must be inside the same country store in which app lives. Suppose, you are in India Store. But, app is not available for India store. Then app will not open. (3) App must be available for that device. (iPod, iPhone, iPad). Suppose, you are testing the app in iPhone. And open the app which is only available for iPad. Then it will not open in iPhone device. Please have a check it and let me know in case of difficulty.
-
Nishant B almost 13 yearsplease check all the paramter. I am able to open it. Or open the above url in Safari and check is it open or not.
-
Senthilkumar almost 13 yearsThe above url will be open in safari but not open in iphone or ipod touch device.
-
Senthilkumar almost 13 yearsDear Nishant Bhindi, Thanks for giving an idea. Yes that link is not in indian app store. That is the problem to me.I solve this problem with your idea. Once again Thanks a lot!
-
Nishant B almost 13 yearsYou Welcome. Will you please right this as Answer and up vote?
-
PengOne almost 13 yearsMake sure there is an internet connection. I use this n my apps and it works great.
-
sig over 8 yearsThis helped me in iOS 9 because every time i tried to open iTunes link my Music app appears. (instead of iTunes app with Purchase options). Thanks a lot.