Http://blog.csdn.net/arthurchenjs/article/details/8447983
How can I start an app store from my own app? At the same time, how do I link to my own apps in the store?
-[UIApplication openURL:]
Processes incoming links to applications and media.NSURL
Object To start the corresponding Store application. Follow these steps to obtain the link: app, song, And album in iTunes, and link it to your iPhone app.
Start iTunes on your computer
Search for the project you want to add
Right-click or control and click the project name in iTunes. In the displayed menu, choose Copy iTunes store URL"
Use-[UIApplication openURL:]
Open the modified URL string andNSURL
Object.
Note: You can also use the iTunes link maker tool to obtain links to app songs or albums stored in ituns. See the iTunes link maker FAQ to learn more about the tool.
The following is an example of starting app store from a native application.
NSString *iTunesLink = @http://itunes.apple.com/us/app/id284417350?mt=8;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];
There are some iTunes links, including iTunes-related links. Multiple redirects are returned before the links are linked to the corresponding application. You can useNsurlconnection silently processes these redirects and opens the final URL when the redirection is complete. This allows your applications to directly switch to the store without starting safari. The following shows how to complete this action.
NOTE: If your iTunes link is in uiwebview, you can use this method in-[UIWebViewDelegate webView:shouldStartLoadWithRequest:navigationType:]
Intercept links in the entrusting method.
Process iTunes-related links on iPhone
// Process a LinkShare/TradeDoubler/DGM URL to something iPhone can handle
- (void)openReferralURL:(NSURL *)referralURL
{
NSURLConnection *con = [[NSURLConnection alloc] initWithRequest:[NSURLRequest requestWithreferralURL] delegate:self startImmediately:YES];
[con release];
}
// Save the most recent URL in case multiple redirects occur
// "iTunesURL" is an NSURL property in your class declaration
- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response
{
self.iTunesURL = [response URL];
if( [self.iTunesURL.host hasSuffix:@"itunes.apple.com"])
{
[connection cancel];
[self connectionDidFinishLoading:connection];
return nil;
}
else
{
return request;
}
}
// No more redirects; use the last URL saved
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
[[UIApplication sharedApplication] openself.iTunesURL];}