On the iPhone, how can you cause a URL to display an entry in the App Store?

前端 未结 3 1193
别跟我提以往
别跟我提以往 2021-01-13 09:51

For instance, if someone views a URL for an app on the iPhone, we would like the URL to open the App Store and display the entry related to that app. The idea is to allow d

3条回答
  •  醉酒成梦
    2021-01-13 10:27

    App Store uses the following url format for apps:

    http://itunes.com/app/your-app-name
    

    so you can use the following code to open the url:

    - (void) buyButtonPressed{
        NSURL *url = [NSURL URLWithString:@"http://itunes.com/app/your-app-name"];
        [[UIApplication sharedApplication] openURL:url];    
    }
    

提交回复
热议问题