gpt4 book ai didi

ios - 从 UIwebview 打开并安装 iOS 应用程序

转载 作者:行者123 更新时间:2023-11-29 02:57:25 25 4
gpt4 key购买 nike

我有一个应用程序链接,使用来自 AppStore 的链接生成器。我的应用程序中有一个 UIWebView,我试图在 UIWebView 中加载链接,但每次我加载该链接时,它都会打开内置的 AppStore,而不是在UIWebView。我想在 UIWebView 中打开链接,而不是打开内置的 iOS AppStore。

这是我试过的

- (void)viewDidLoad
{
str = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa";
str = [NSString stringWithFormat:@"%@/wa/viewContentsUserReviews?", str];
str = [NSString stringWithFormat:@"%@type=Purple+Software&id=", str];

// Here is the app id from itunesconnect
str = [NSString stringWithFormat:@"%@289382458", str];

[webOpenApp loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
}

-(BOOL) webView:(UIWebView *)inWeb
shouldStartLoadWithRequest:(NSURLRequest *)inRequest
navigationType:(UIWebViewNavigationType)inType
{
if (inType == UIWebViewNavigationTypeOther) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
return NO;
}

return YES;
}

最佳答案

itms-apps:// 是一个特殊的协议(protocol),当 iOS 系统读取它时,它会启动 App Store 以显示该应用程序。显然这不是您想要的。

您应该自己构建 UI 来显示应用程序的信息。当用户单击购买按钮时,您必须将用户重定向到 App Store。因为 App Store 是用户购买和下载应用程序的唯一场所。

关于ios - 从 UIwebview 打开并安装 iOS 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23731534/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com