gpt4 book ai didi

ios - "scan credit card"功能和 UIWebView 或 WKWebView

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:59:57 28 4
gpt4 key购买 nike

我有一张信用卡表格,当在我的 iPhone 上的 Safari 中查看时,它会显示 iOS8 功能“扫描信用卡”。它很好用。用户可以使用 iPhone 上的摄像头扫描信用卡。我通过在输入字段上添加 HTML5 自动完成标记(cc-number、cc-exp-year、cc-exp-month)来完成此操作。然后 Safari 会自动识别并激活扫描功能。但是我想在我的 iOS 应用程序内的 WebView 中显示它。表格显示,但扫描功能不显示。这可能吗?

这是同一个问题:Is the Scan Credit Card option available on the WebView?

我想在那里发表评论,但我是新用户所以不能吗?

最佳答案

我一直在试验,但无法在 UIWebView 或 WKWebView 中完成这项工作。源 html 文件是从启用 https 的服务器提供的。从 Safari 访问 URL 时会显示“AutoFill Credit Card”,但嵌入 iOS 时不会显示。遗憾的是,我认为 UIWebView 或 WKWebView 不支持此功能。

<!DOCTYPE html>
<html>
<head>
<title>Scan credit card using iOS</title>
<style type="text/css">
/*<![CDATA[*/
input {height:1.5em;width:95%}
input[type="text"] {font-size: 2.5em}
body {background-color:lightgray;font-size: 3em;font-family: sans-serif;}
#purchase {font-size: 2em;font-weight: bold;height:1.2em}
/*]]>*/
</style>
</head>
<body>
<form action="https://yoursite.com/credit-card-purchase" method="post">
<label for="nameoncard">Name on Card</label>
<input autocomplete="cc-name" id="nameoncard" name="nameoncard" type="text">
<label for="ccnumber">Credit Card Number</label>
<input autocomplete="cc-number" id="ccnumber" name="ccnumber" type="text">
<label for="cc-exp-month">Expiration Month</label>
<input autocomplete="cc-exp-month" id="cc-exp-month" name="cc-exp-month" type="text">
<label for="cc-exp-year">Expiration Year</label>
<input autocomplete="cc-exp-year" id="cc-exp-year" name="cc-exp-year" type="text">
<label for="cvv2">CVV</label> <input autocomplete="cc-csc" id="cvv2" name="cvv2" type="text">
<input name="submit" type="submit" value="Submit">
</form>
</body>
</html>

- (void)viewDidLoad {
[super viewDidLoad];

NSURL *nsurl = [NSURL URLWithString:@"https://www.myhttpsserver.co.uk/test.html"];

BOOL showWKWebView = YES;

if (showWKWebView) {
//WKWebView version
WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] init];
WKWebView *webView = [[WKWebView alloc] initWithFrame:self.view.frame configuration:theConfiguration];

NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];
[webView loadRequest:nsrequest];
[self.view addSubview:webView];
} else {
//UIWebView version
UIWebView *webView = [[UIWebView alloc] initWithFrame: self.view.frame];
webView.delegate = self;

NSURLRequest *request = [[NSURLRequest alloc] initWithURL:nsurl cachePolicy: NSURLRequestUseProtocolCachePolicy timeoutInterval: 5.0];
[webView loadRequest:request];
[self.view addSubview:webView];
}
}

关于ios - "scan credit card"功能和 UIWebView 或 WKWebView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32477162/

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