Colendi WebView SDK
Colendi WebView 软件开发套件。
目录
概述
Colendi WebView 是 Colendians 开发的一个软件开发套件,可快速简便地集成到 Colendi World。
要求
一般要求
SDK要求的最低iOS版本为
- iOS 11.0及以上
权限
Colendi WebView SDK使用了设备的相机和NFC。您需要在应用程序的Info.plist文件中添加以下密钥
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A0000002471001</string>
</array>
<key>NFCReaderUsageDescription</key>
<string>This application requires access to NFC to scan IDs.</string>
<key>NSCameraUsageDescription</key>
<string>This application requires access to your camera for scanning and uploading the document.</string>
注意:所有密钥都需要用于应用提交。
授予访问NFC权限
在目标签名和功能中启用近场通信标签读取功能。
安装
通过CocoaPods
ColendiWebView 可以通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中:
pod 'ColendiWebViewSDK'
在 Podfile 最后一个结束语句之后也添加上。
#add following lines end of podfile after last 'end'
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
#if you have intel Mac you need to comment out following line
#config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
if target.name == 'lottie-ios'
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
end
end
然后,运行以下命令:
$ pod install
集成
import UIKit
import ColendiWebViewSDK
class ViewController: UIViewController, ColendiWebViewDelegate {
var colendiView: ColendiWebView?
override func viewDidLoad() {
super.viewDidLoad()
colendiView = ColendiWebView(frame: self.view.frame)
colendiView?.setDelegate(delegate: self)
/// Set insetsLayoutMarginsFromSafeArea false before loadUrl function to open ColendiWebView fullscreen.
colendiView?.insetsLayoutMarginsFromSafeArea = false
self.view.addSubview(self.colendiView!)
//Change the 'URL' with colendi web app's url
let url = URL(string: "URL")!
colendiView?.loadUrl(url: url)
}
func messageCallback(message: String) {
print(message)
}
}
ColendiWebViewDelegate 中的可选函数
func decidePolicyForNavigationAction(decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {}
func didReceiveAuthenticationChallenge(didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {}
func didFailNavigation(didFail navigation: WKNavigation!, withError error: Error) {}
作者
Gökberk Bardakçı,Uygar İşívelik,来自 Colendi
许可证
ColendiWebView 在 GNU 通用公共许可证的许可下可用。更多信息请参阅 LICENSE 文件。