我遇到了一个问题,我无法通过在这里或在Google上搜索来找到解决方案.
我正在构建一个由多个开发人员共享的项目.出于某种原因,我是唯一有这个问题的人.我多次检查了代码,甚至重新安装了Xcode.
所以当我构建项目时,构建过程将永远挂起.一个名为"Interface Builder Cocoa Touch Tool"的进程运行并开始累积RAM,直到达到Mac的限制(16 GB).此时,只要我看到我终止进程并且构建失败.
在控制台应用程序上,我看到:
2014-10-02 4:45:16.013 PM Interface Builder Cocoa Touch Tool[875]: BUG in libdispatch client: kevent[EVFILT_VNODE] add: "Bad file descriptor" - 0x9
2014-10-02 4:45:17.956 PM Interface Builder Cocoa Touch Tool[875]: assertion failed: 13F34: libxpc.dylib + 29453 [75E30F22-514B-3A20-B82C-EDA43AF5C35C]: 0x8d
Run Code Online (Sandbox Code Playgroud)
在Xcode上,我看到构建卡在"编译1个故事板文件中的1个"或"编译1个1资产目录"中.
即使我停止构建,"Interface Builder Cocoa Touch Tool"进程仍将继续运行并累积RAM.
我确实看到了与故事板有关的两个警告:
Base.lproj/MainStoryboard.storyboard Frame for "Scroll View" will be different at run time.
Base.lproj/MainStoryboard.storyboard: warning: Unsupported Configuration: Prototype table cells must have reuse identifiers
Run Code Online (Sandbox Code Playgroud)
我看到资产的两个警告:
../Images-2.xcassets: A 57x57 app icon is …Run Code Online (Sandbox Code Playgroud) 我有代码可以在iOS上运行.使用我在这里和网络上找到的任何东西,我设法在某个地方制作Cocoa Mac Os版本,但图像不会加载.CSS和Javascript似乎也没有加载.HTML的目录被添加到Resources组,但它被添加为Folder References(蓝色文件夹),这使得Xcode尊重HTML App的目录结构.
这是我正在尝试使用的代码:
NSString *htmlPath = [[NSBundle mainBundle] pathForResource:@"index"
ofType:@"html"
inDirectory:@"/Patient_eMMR_HTML5" ];
NSString *html = [NSString stringWithContentsOfFile:htmlPath
encoding:NSUTF8StringEncoding
error:nil];
[[webView mainFrame] loadHTMLString:html baseURL:[NSURL fileURLWithPath:
[NSString stringWithFormat:@"%@/Patient_eMMR_HTML5/",
[[NSBundle mainBundle] bundlePath]]]];
Run Code Online (Sandbox Code Playgroud)
这是我使用上面使用的代码的代码的iOS版本:
NSString *htmlPath = [[NSBundle mainBundle] pathForResource:@"index"
ofType:@"html"
inDirectory:@"/Patient_eMMR_HTML5" ];
NSString *html = [NSString stringWithContentsOfFile:htmlPath
encoding:NSUTF8StringEncoding
error:nil];
[webView loadHTMLString:html
baseURL:[NSURL fileURLWithPath:
[NSString stringWithFormat:@"%@/Patient_eMMR_HTML5/",
[[NSBundle mainBundle] bundlePath]]]];
Run Code Online (Sandbox Code Playgroud)
任何帮助是极大的赞赏.谢谢.
我是Android的完整菜鸟,这只是一个简单的测试.基于本教程.
这是HelloWebApp.java
package com.company.something;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class HelloWebApp extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView webView = (WebView)findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("file:///android_asset/www/index.html");
}
}
Run Code Online (Sandbox Code Playgroud)
这是来自res/layout/main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<WebView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/webView"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
另外,这是我在Manifest上改变的全部内容:
<activity android:name=".HelloWebApp"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
android:screenOrientation="landscape">
Run Code Online (Sandbox Code Playgroud)
至于javascript,我已经尝试了一切.复杂,简单,在底部的身体内,在按钮上,在头上.什么都行不通.HTML工作正常.
在此先感谢您的帮助.
编辑:
所以答案就在这篇文章中:从资源中将javascript加载到UIWebView中
您将找到加载带有目录的HTML5应用程序时需要了解的所有内容,只需确保在Xcode项目中删除文件,然后单击"为任何添加的文件夹创建文件夹引用"单选按钮.然后只使用我在那里添加的链接上的代码.
感谢Sergio的帮助.
我已经多次通过StackOverflow了,我找到的代码都没有显示我的html5应用程序的图像.困难的部分似乎是从不同的子目录加载文件.我不想把所有内容都放在root中,然后在Xcode中使用这些组,因为我必须重新考虑很多HTML5代码.
我想把它作为一个轻容器来构建,而不必使用PhoneGap.除了PhoneGap带来了更大的bug(我测试了我们的应用程序,它在iPad上崩溃并在iPhone上工作).处理HTML5方面和Cocoa Touch很难.
所以这是我加载HTML页面的方式:
[webView loadRequest:[NSURLRequest requestWithURL:
[NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"index" ofType:@"html"]isDirectory:NO]]];
Run Code Online (Sandbox Code Playgroud)
我找到了一些解决方案,当我将文件添加到资源文件夹时,它让我更接近"为任何添加的文件夹创建文件夹引用",我现在可以看到正在加载的一些图像.JS似乎没有正常工作.我已经测试了这个应用程序从本地服务器上运行的URL加载它,它确实在这种情况下工作.
所以CSS显然在工作,图像也是如此,但JS似乎是一个问题.
希望我能很快找到答案.
旧
(这是我以错误的方式包含文件夹的时候)
因此,你们不必想知道我在看什么(它看起来像js和图像没有加载,我在HTML5应用程序上有子目录):

有趣的帖子与此相关:
我正在与服务器通信,JSON响应如下所示:
someResponse({ "Response":{"status":"3","message":"Not valid bla bla"} });
Run Code Online (Sandbox Code Playgroud)
正确的JSON应该是这样的,对吧?:
{
"response":
{
"status":"3",
"message":"Not valid bla bla"
}
}
Run Code Online (Sandbox Code Playgroud)
有没有办法我可以用jQuery以某种方式获取该数据,如果包含在"someResponse"函数中?
我的jQuery代码如下所示:
$.ajax({
url: "https://someurl/test/request.asp?user=x&pass=x",
dataType: "JSONP",
success: function(msg){
$("#json_here").html(msg.response.status);
},
error:function(x,e){alert(x+" :: "+e)}
});
Run Code Online (Sandbox Code Playgroud)
当然,当我这样做时没有任何反应.但如果我做$("#json_here").html(msg); 那么我就像上面那样得到完整的回应.
我做错了什么或者这是一种无效的发送JSON数据的方式?我没有得到解析错误.
提前致谢.
到目前为止,我的代码工作正常,但我必须创建一个类UIView.这有点不方便,因为我也需要与ViewController进行交互.
顺便说一句,我曾尝试[self setNeedsDisplay]在ViewDidLoad该的UIViewController子类的文件,但没有奏效.
这是代码,它在UIViewSubclass上工作但不会在一个上调用UIViewController:
- (void)drawRect:(CGRect)rect
{
UIColor *currentColor = [UIColor redColor];
CGContextRef context = UIGraphicsGetCurrentContext();
someNum = 1;
CGContextBeginPath(context);
CGContextMoveToPoint(context, 30, 40);
[self addDotImageX:30 andY:40];
CGContextSetLineWidth(context, 2);
CGContextSetStrokeColorWithColor(context, currentColor.CGColor);
CGContextStrokePath(context);
}
Run Code Online (Sandbox Code Playgroud)
关于尝试什么的任何想法?顺便说一句,这是一个TabBar应用程序.我知道那些可以以某种方式阻止调用drawRect.
以编程方式创建的选项卡,而不是通过Nib.例如:
NSMutableArray *listOfViewControllers = [[NSMutableArray alloc] init];
UIViewController *vc;
vc = [[Education alloc] init];
vc.title = @"Education";
[listOfViewControllers addObject:vc];
vc.tabBarItem.image = [UIImage imageNamed:@"info.png"];
[vc release];
Run Code Online (Sandbox Code Playgroud)
我很感激任何想法.我已经浏览了这个网站上setNeedsDisplay没有打电话drawRect的答案,但没有找到我的具体案例的答案.
谢谢.