App跳轉(zhuǎn)到App Store

1.直接跳轉(zhuǎn)到 App Store?

1.進入appstore中指定的應(yīng)用

NSString *str = [NSString stringWithFormat:

@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa /wa/viewContentsUserReviews?type=Purple+Software&id=%d",

myAppID ];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

其中myAppID為itunesconnect中的應(yīng)用程序id

2.進入首頁

NSString *str = [NSString stringWithFormat:

@"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=%@",

m_myAppID ];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

2.在應(yīng)用內(nèi)打開

//設(shè)置代理請求為當(dāng)前控制器本身

SKStoreProductViewController*storeProductViewContorller = [[SKStoreProductViewControlleralloc] init];

//加載一個新的視圖展示

storeProductViewContorller.delegate =self;

//appId唯一的

[storeProductViewContorller loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:@"1049660516"} completionBlock:^(BOOLresult,NSError*error) {//block回調(diào)

if(error){

NSLog(@"error %@ with userInfo %@",error,[error userInfo]);? ?

?}else{//模態(tài)彈出

appstore[selfpresentViewController:storeProductViewContorller animated:YEScompletion:^{? ? ? ? }? ? ?

?? ? ];? ??

} }]

//取消按鈕監(jiān)聽

- (void)productViewControllerDidFinish:(SKStoreProductViewController*)viewController{? ? [selfdismissViewControllerAnimated:YEScompletion:^{? ? }];

}

3.跳轉(zhuǎn)到評論

NSString *appstoreUrlString = [NSString stringWithFormat:

@"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%@",

m_appleID ];

NSURL * url = [NSURL URLWithString:appstoreUrlString];

if ([[UIApplication sharedApplication] canOpenURL:url]){

[[UIApplication sharedApplication]openURL:url];

}else {

NSLog(@"can not open");

}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容