使用google toolbox for mac编译单元测试时出错 [英] Error compiling for unit test using google toolbox for mac

查看:34
本文介绍了使用google toolbox for mac编译单元测试时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序运行良好,但是当我尝试运行单元测试时出现此错误...

Hi my application runs fine but when I try to run the unit tests I am getting this error...

2010-10-19 00:27:49.919 AssignmentUnitTest[27988:903] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 
'*** -[NSURL initFileURLWithPath:]: nil string parameter'

讽刺的是我已经搜索了整个项目 &我没有任何使用 **[NSURL initFileURLWithPath:]**

Irony is I have searched the whole project & I dont have any similar line of code that uses **[NSURL initFileURLWithPath:]**

我几乎浪费了半天时间,但没有任何成功.

I have pretty much wasted half of my day on it without any success.

我在项目中使用 coredata &下面是带有堆栈跟踪的屏幕截图.

I am using coredata in the project & below is the screen shot with stack trace.

谁能指导我走向正确的方向.

Can anyone please guide me to the right direction.

谢谢

**EDit : ** 解决这个问题的方法不仅是添加 .xcdatamodel 文件,还有根文件 .xcdatamodeld.Core Data 无法找到我的模型,因此显示此错误.希望有一天它可以帮助某人.

**EDIt : ** The solution to this problem is to add not only the .xcdatamodel file but the root file .xcdatamodeld. Core Data was having trouble finding my model so was displaying this error. Hope it helps somebody someday.

推荐答案

阅读屏幕截图中的调用堆栈.它说您的 managedObjectModel 方法发送了 [NSURL fileURLWithPath:],并且 那个 调用了 initFileURLWithPath:.因此,找到您发送 [NSURL fileURLWithPath:] 的点并将您的参数修正为该消息.

Read the call stack in your screenshot. It says your managedObjectModel method sent [NSURL fileURLWithPath:], and that called initFileURLWithPath:. So, find the point where you sent [NSURL fileURLWithPath:] and fix your argument to that message.

您传递的参数无效表明您为路径传递了 nil(也许您试图在包中找到该文件,但它不存在或名称与您看起来不同for),或者您传递了一个指向不是字符串的对象的指针(也许您有一个字符串但保留不足,并在其位置创建了一个不同的对象).

The argument you passed being invalid suggests that either you passed nil for the path (perhaps you tried to find the file in your bundle but it isn't there or has a different name than you looked for), or you passed a pointer to an object that isn't a string (perhaps you had a string but under-retained it and a different object was created in its place).

这篇关于使用google toolbox for mac编译单元测试时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆