Open native apps, open AppStore apps, and app scoring for iOS development

Source: Internet
Author: User

In app development, there are often features that invite users to rate apps. In iOS, the official app is downloaded through AppStore, so the app can be scored only in AppStore. Therefore, you need to jump from the app to AppStore. The method is to open the URL of the response. The code is as follows:

NSString *appid = @ "1234567"; NSString *str = [NSString stringwithformat:@ "itms-apps://itunes.apple.com/cn/app/id%@?mt=8", AppID]; Nsurl *url = [Nsurl urlwithstring:str]; [[UIApplication sharedapplication] openurl:url];

Where AppID is an app release, Apple claims a bunch of numbers that do not need to be set up, and the project name is not the same as the ID. When using, only need to change the AppID to their own appid, the previous URL does not need to change.

In some cases, the company may have a variety of apps, so there will be a need: Each app has a product recommendation feature, through the current app can open other apps (already installed), if not installed, then skip to AppStore download.

For example, the Input Method app can recommend Sogou search, when the user click on the Sogou search icon, the current user to detect whether the app on the phone. If so, open the app directly and if not, jump to AppStore to download the app.

Jump to AppStore download need to know the URL of the app. To open the app locally, you need to know the app's ID (project name, such as Com.sogou.search) and protocol name (can have, can not, such as Sohu), the final URL is the protocol name://app ID, such as sohu:// Com.sogou.search.

The code is as follows:

Nsurl *customurl = [Nsurl urlwithstring:[nsstring stringwithformat:@ "%@://%@", Product.scheme,product.identifier]]; UIApplication *app = [UIApplication sharedapplication];if ([app Canopenurl:customurl]) {        //have app installed, open app        [app Openurl:customurl];} else{        [app Openurl:[nsurl URLWithString:product.url];}

  

  

Open native apps, open AppStore apps, and app scoring for iOS development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.