答案 0 :(得分:2)
你的代码在哪里? 你使用了webView吗?
我使用了这种方法:
[_webView loadRequest:[NSURLRequest requestWithURL:url]];
答案 1 :(得分:1)
<强>步骤1 强>
最初在.plist中添加
NSAppTransportSecurity
,请参阅this
<强>步骤-2 强>
调用网址
NSString *urlAddress = @"http://1-dot-smartrefill-968.appspot.com/#/#mfucci@gmail_com";
[self.yourwebviewName loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSURL URLWithString:[urlAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]]];
答案 2 :(得分:1)
尝试使用URL
代替addingPercentEncoding
对stringByAddingPercentEscapesUsingEncoding
进行编码,因为它已被弃用。
在Swift中:
适用于Swift 3 :
let strUrl = "http://1-dot-smartrefill-968.appspot.com/#/#mfucci@gmail_com"
let encodedUrl = strUrl.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)
对于Swift 2.3或更低版本:
let encodedUrl = strUrl.stringByAddingPercentEncodingWithAllowedCharacters(.URLHostAllowedCharacterSet())
在Objective-C
NSString *strUrl = @"http://1-dot-smartrefill-968.appspot.com/#/#mfucci@gmail_com";
NSString *encodedUrl = [strUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]];
答案 3 :(得分:0)
swift :
$('#word').load()
objective-c
var url : NSString = "http://1-dot-smartrefill-968.appspot.com/#/#mfucci@gmail_com"
var urlStr : NSString = url.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)!
var searchURL : NSURL = NSURL(string: urlStr)!
webviewInstance.loadRequest(NSURLRequest(URL: searchURL))