- 應(yīng)用外跳轉(zhuǎn)
UIApplication.shared.openURL(URL(string: "http://itunes.apple.com/cn/app/wechat/id836500024?mt=12")!)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/cn/app/wechat/id836500024?mt=12"]];
- 應(yīng)用內(nèi)跳轉(zhuǎn)
private func jumpStoreScore() {
let storeCtrlr = SKStoreProductViewController()
storeCtrlr.delegate = self
storeCtrlr.loadProduct(withParameters: [SKStoreProductParameterITunesItemIdentifier: "836500024"]) { [weak self] (isSuccess, error) in
if isSuccess {
self?.present(storeCtrlr, animated: true, completion: {
})
}else {
print("error:\(String(describing: error))")
}
}
}
func productViewControllerDidFinish(_ viewController: SKStoreProductViewController) {
dismiss(animated: true) {
print("取消 productViewControllerDidFinish")
}
}
- (void)jumpStoreScore {
SKStoreProductViewController *storeProductViewContorller = [[SKStoreProductViewController alloc] init];
storeProductViewContorller.delegate=self;
[storeProductViewContorller loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:@"836500024"} completionBlock:^(BOOLresult,NSError*error) {
if(error) {
NSLog(@"error %@ with userInfo %@",error,[erroruserInfo]);
}else{
[self presentViewController: storeProductViewContorller animated:YES completion: nil];
}
}];
}
//AppStore取消按鈕監(jiān)聽
- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
[self dismissViewControllerAnimated:YES completion:nil];
}
使用應(yīng)用外的方式可以實(shí)現(xiàn)進(jìn)入AppStore頁面
使用應(yīng)用外跳轉(zhuǎn)就是調(diào)不起來,提示:
2017-06-21 16:23:26.787090+0800 xxxx[3308:202712] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/xx/Library/Developer/CoreSimulator/Devices/17CBA861-06CE-40AF-BDDF-88A5A087AF04/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-06-21 16:23:26.788148+0800 xxxx[3308:202712] [MC] Reading from private effective user settings.
好像也沒什么權(quán)限問題設(shè)置的,調(diào)不起來也不知道咋回事。。先放著吧,要用的時候在調(diào)