【发布时间】:2015-09-18 22:24:15
【问题描述】:
我创建了与 ios 7 和 ios 8 兼容的应用程序,但 ios 7 上的 UIWebview 从未调用过,我得到了
void SendDelegateMessage(NSInvocation *): 委托 (webView:decidePolicyForNavigationAction:request:frame:decisionListener:) 等待 10 秒后未能返回。主运行循环模式: kCFRunLoopDefaultMode
我在互联网上搜索但没有解决方案 4天尝试,没有运气..
class AWTncViewController: UIViewController, UIWebViewDelegate{
@IBOutlet weak var wv: UIWebView!
deinit {
NSNotificationCenter.defaultCenter().removeObserver(self)
wv.delegate = nil
}
override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad()
self.wv.delegate = self;
let myHTMLString:String! = "<h1>Hello word!</h1>"
self.wv.loadHTMLString(myHTMLString, baseURL: nil)
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
/* Test 2 still not load
let myHTMLString:String! = "<h1>Hello word!</h1>"
self.wv.loadHTMLString(myHTMLString, baseURL: nil)
*/
}
func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool {
//this never called
println("shouldStartLoadWithRequest execute")
return true
}
func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool
{
//this never called
println("shouldStartLoadWithRequest execute")
return true
}
func webViewDidStartLoad(webView: UIWebView)
{
//this never called
println("Start load")
}
func webViewDidFinishLoad(webView: UIWebView)
{
//this never called
println("FinishLoad")
}
func webView(webView: UIWebView, didFailLoadWithError error: NSError)
{
//this never called
println("didFailLoadWithError: \(error.description)")
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
我读到了这个:iOS 7 UIWebView not rendering
但我没有使用 Crittercism
【问题讨论】:
标签: ios swift uiwebview xcode6