html - 无法使用 loadHTMLString :baseURL in iOS? 在 UIWebView 中加载 html 字符串

标签 html iphone ios uiwebview

我正在尝试将 youtube 视频嵌入到我的 iOS 应用程序中。为此我创建了一个 UIWebView 并尝试从以下 here 加载 Youtube 视频

我已经完成了上述问题的所有答案。即使那样它也不起作用。 我也试过加载非常简单的 HTML

 NSString *embedHTML =[NSString stringWithFormat:@"<html><body>Hello World</body></html>"];
 [webView loadHTMLString:embedHTML baseURL:nil];

即便如此,我还是遇到编译错误 Parse Issue Expecte ']'

我尝试过清理、退出 XCode 并重新启动它。我不知道,我无法使用该方法。如何为我的 UIWebView 使用上述 loadHTMLString 方法。

附言:请不要将此问题标记为重复。我已经尝试了 Stackoverflow 中的所有解决方案。没有任何效果

最佳答案

WebView *webDesc = [[UIWebView alloc]initWithFrame:CGRectMake(12, 50, 276, 228)];

NSString *embedHTML = @"<html><head></head><body><p>1. You agree that you will be the technician servicing this work order?.<br>2. You are comfortable with the scope of work on this work order?.<br>3. You understand that if you go to site and fail to do quality repair for  any reason, you will not be paid?.<br>4. You must dress business casual when going on the work order.</p></body></html>";

webDesc.userInteractionEnabled = NO;
webDesc.opaque = NO;
webDesc.backgroundColor = [UIColor clearColor];
[webDesc loadHTMLString: embedHTML baseURL: nil];

关于html - 无法使用 loadHTMLString :baseURL in iOS? 在 UIWebView 中加载 html 字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17155458/

相关文章:

ios - 将纬度/经度转换为 MKMapItems 以获取方向

ios - 如何继承 UIViewControllers?

javascript - 由于编码错误,oninput 和 onchange 无法正常工作

javascript - 尝试读取元素的文本仅显示第一个元素的文本

ios - 从自定义表格单元格中发送参数到 segue?

iphone - 用于集成离线和在线 Apache Solr 搜索的 iOS 框架

html - 在 Bootstrap 工具提示中强制换行

javascript - Firefox 3.6 <label><p> 渲染问题

iPhone:隐藏工具栏

iphone - 关闭屏幕