Pedestrian crossings on ios - cannot find XWalkView module
I am trying to use crosswalk to build my web app in an iOS app. Quickstart and I follow the steps on this page https://github.com/crosswalk-project/crosswalk-ios
but I am now faced with a problem:
in the ViewController.swift
When I import XWalkView
, it always seems that he can not find the module XWalkView
that makes me stop from my development ...
Someone help me.
Here's the code ViewController.swift
:
import UIKit
import WebKit
import XWalkView
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
var start_url = "index.html"
var xwalk_extensions = ["Extension.load"]
if let plistPath = NSBundle.mainBundle().pathForResource("manifest", ofType: "plist") {
if let manifest = NSDictionary(contentsOfFile: plistPath) {
start_url = manifest["start_url"] as? String ?? start_url
xwalk_extensions = manifest["xwalk_extensions"] as? [String] ?? xwalk_extensions
}
}
let webview = WKWebView(frame: view.frame, configuration: WKWebViewConfiguration())
webview.scrollView.bounces = false
view.addSubview(webview)
for name in xwalk_extensions {
if let ext: AnyObject = XWalkExtensionFactory.createExtension(name) {
webview.loadExtension(ext, namespace: name)
}
}
if let root = NSBundle.mainBundle().resourceURL?.URLByAppendingPathComponent("www") {
var error: NSError?
let url = root.URLByAppendingPathComponent(start_url)
if url.checkResourceIsReachableAndReturnError(&error) {
webview.loadFileURL(url, allowingReadAccessToURL: root)
} else {
webview.loadHTMLString(error!.description, baseURL: nil)
}
}
}
override func prefersStatusBarHidden() -> Bool {
return true
}
}
source to share
perhaps you forgot to link the XWalkView.framework in your target program?
Try this step: Open Xcode, select your application project, under General → Linked Structures and Libraries, select +, select XWalkView.framework to add it to link frames. Then another collection was fired. It's ok if the XWalkView.framework turns red.
source to share