I'm having problems opening the app store (to suggest an app update).
This is what i'm doing:
NSURL *url = [NSURL URLWithString:#"macappstore://itunes.apple.com/app/id[my_id]?mt=12"];
if ([[UIApplication sharedApplication] canOpenURL:url]){
[[UIApplication sharedApplication] openURL:url];
}
canOpenURL is returning false, also i tried without the conditional but it doesn't work.
In addition i tried to use NSWorkspace instead the openURL method in UIApplication but i'm having compilation errors, surely this are dependencies issues but i couldn't find Cocoa.framework and neither AppKit.framework to add one of them to the binaryLibraries of my project.
For iOS, you should be using the prefix itms-apps:// instead of macappstore://. This will link you directly to the App Store app, instead of through a Safari redirect (as http:// or https:// will do).
Lots more on this topic covered here:
How to link to apps on the app store
Related
Im using this code to open AppStore app url , which is working fine am trying to launch then app it self not just open the appstore app page
any tips how i can do this using NSURL
dispatch_async(dispatch_get_main_queue(), ^{
NSURL *appStoreUrl = [NSURL URLWithString:#"https://itunes.apple.com/us/app/cnn-app-for-iphone/id331786748?mt=8"];
[[UIApplication sharedApplication] openURL:appStoreUrl];
});
You can only open the app itself if it supports a custom URL-scheme. Posting from Tweetbot is enabled by opening the url tweetbot:///post?
Alot of pages lists the urls you need to interact with other apps, see for instance http://handleopenurl.com/ or http://wiki.akosma.com/IPhone_URL_Schemes for other examples and apps
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"itms://itunes.com/apps/appname"]];
I am trying to open Google Maps App from inside an iOS App.
I am using this code:
[[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:#"comgooglemaps://?center=40.765819,-73.975866&zoom=14&views=traffic"]];
but its not working. Can anyone tell me whats the issue?
First of all canOpenURL won't open an app. It just checks that the app can open the app or not. Use openURL method instead.
if([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:#"comgooglemaps://?center=40.765819,-73.975866&zoom=14&views=traffic"]])
{
[[UIApplication sharedApplication] openURL: [NSURL URLWithString:#"comgooglemaps://?center=40.765819,-73.975866&zoom=14&views=traffic"]];
}
Note:
For opening a third party app using the URL Scheme. It should be installed on the device.
canOpenURL:
Returns whether an application can open a given URL resource.
- (BOOL)canOpenURL:(NSURL *)url
Parameters
url
A URL object that identifies a given resource. The URL’s scheme—possibly a custom scheme—identifies which application can
handle the URL.
Return Value
NO if no application is available that will accept the URL; otherwise,
returns YES.
Discussion
This method guarantees that that if openURL: is called, another
application will be launched to handle it. It does not guarantee that
the full URL is valid.
openURL:
Opens the resource at the specified URL.
- (BOOL)openURL:(NSURL *)url
Parameters
url
An object representing a URL (Universal Resource Locator). UIKit supports the http:, https:, tel:, and mailto: schemes.
Return Value
YES if the resource located by the URL was successfully opened;
otherwise NO.
Discussion
The URL can locate a resource in the same or other application. If the
resource is another application, invoking this method may cause the
calling application to quit so the other one can be launched.
You may call canOpenURL: before calling this one to verify that there
is an application that can handle it.
Please refer UIApplication Class.
Im opening a map like this:
NSString *urlString = [NSString stringWithFormat:#"http://maps.google.com/maps?q=%#,%#", destLat, destLong];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
Is there any way to choose with which app will open the map? For example, Safari, or the maps app, or Tom Tom app...
Yes, you should use one of the iPhone URL schemes. There is a pretty hefty list available here.
Note that you should first check if the application you want to launch is available before using a certain URL scheme.
If Tom Tom exposes some url scheme you can try that one. Otherwise the default url scheme handlers are "hard coded" to the system and you can't override / change them i.e. "http:" will be always opened by Safari except for "maps.google.com" domains, etc.
Hi i want to open app store with in our application with the specific publisher search or specific application types..on clicking of button..let's say More App's...
You can get the appropriate URL to your app here:
http://itunes.apple.com/linkmaker
If you enter the name of your company the linkmaker will provide an "artist link" that shows all of your apps.
If you use the itms-apps:// prefix the user is sent directly to the
App Store App with the specified app showing rather than the ugly
first-Safari-then-the-App-Store-App shuffle that you get without that
UTI. A la:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:
#"itms-apps://yourAppLinkHere"]];
To generate a link that is universal and not specific to an App Store Country do the following
Use
itms-apps://**ax.itunes**.apple.com/app/yourAppLinker
where yourAppLinker is the part of the link generated in (http://itunes.apple.com/linkmaker), as in Matthew Frederick's post, which contains your application name and id
it worked for me
cheers
For IOS7 and later for example:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"itms-apps://itunes.apple.com/app/id547101139"]];
I've seen posts here on Stackoverflow that describe how to allow users to be directed to apps on the app store.
Is there a way to link directly to the rating and comments form in the App Store?
This IS possible using the technique described on this blog:
http://www.memention.com/blog/2009/09/03/Open-Reviews.html
basically you call UIApplication openURL with the following:
NSString* url = [NSString stringWithFormat: #"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%#", myAppID];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
To get your app ID before your app is available in the app store, use iTunesConnect to define your new app - give it a name, description, icon, screenshots, etc. Once defined, you can get the Apple ID from the Identifiers section for the app.
EDIT:
Here is a secondary url/method that works:
NSString* url = [NSString stringWithFormat: #"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=%#&pageNumber=0&sortOrdering=1&type=Purple+Software&mt=8", appid];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url ]];
I believe the difference between the two is that the first technique (itms-apps://) will launch the App Store app directly while the second one (http://) will launch it indirectly via a redirect resulting from the http web URL. This would have to be confirmed; this is only my recollection.
Answers here are outdated.
This works on my end (Xcode 5 - iOS 7 - works only on Device, not simulator!):
itms-apps://itunes.apple.com/app/idYOUR_APP_ID
For versions lower than iOS 7 use the old one:
itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=YOUR_APP_ID
Simple method that I am using is;
-(void)rateApp {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[#"itms-apps://itunes.apple.com/app/" stringByAppendingString: #"id547101139"]]]; }
You can also use SKStoreProductViewController as an alternative. It will open the store in your app. You may like it better than opening another app, especially on iPads.
Thanks to Ahment swift version:
UIApplication.sharedApplication().openURL(NSURL(string: "itms-apps://itunes.apple.com/app/id951334398")!)