Reputation: 2929
I'm implementing a WKWebView that loads a payment page with credit card information; I need to show the 'Use camera' option along with the keyboard just like safari browser.
I have added the camera permission for the info.plist, but nothing is working on the webview!! Should I select a specific keyboard?
I am using iOS 11 with swift 3.2 or 4.0
Here it is my code
var webView : WKWebView = WKWebView()
let configuration = WKWebViewConfiguration()
webView = WKWebView(frame: CGRect.zero, configuration: configuration)
webView.frame = CGRect(x: 0, y: 20, width: self.view.bounds.width, height: self.view.bounds.height)
webView.navigationDelegate = self
webView.uiDelegate = self
webView.scrollView.delegate = self
webView.backgroundColor = UIColor.black
webView.isMultipleTouchEnabled = false
self.view.addSubview(webView)
let newurl = URL(string:"https://xxxxxxxxx")
let newrequest = URLRequest(url: newurl!)
self.webView.load(newrequest)
plus Camera permission
Key : Privacy - Camera Usage Description
Value : $(PRODUCT_NAME) Use camera
Upvotes: 1
Views: 3008
Reputation: 2929
After long research I found SFSafariViewController with its delegate class SFSafariViewControllerDelegate could be used to show the scan card option available on safari, but with limited capabilities compared to the WKWebView, so it's up to your business case to use it or not, but anyway this is the only option available right now according to my knowledge.
Please note that, in order to make it work, you should enable the scan card option on your mobile by changing the settings under the privacy.
Also, you need to be sure that the payment page includes the iOS meta tags to let safari detect the credit card fields.
Upvotes: 0