2010-04-13 77 views
4

我今天的问题是关于Xcode如何处理它创建的应用程序包中的资源文件。我知道这可能是微不足道的,但我找不到一个简单的方法。 基本上我的问题是,即使文件已从项目中删除,Xcode似乎仍然在应用程序包中包含资源文件(例如文本文件)。 这里详细介绍了这里发生的事情。Xcode不会放开资源文件

⁃ Added a file to the project (both by choosing file - new file or dragging a file to the Xcode groups and files left column checking add to project folder if needed checkbox) 
⁃ Compiled and launched the project in simulator 
⁃ Verified that the file is present in myApp.app bundle, located in User/Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app and even in <my Xcode projects folder>/myApp/build/debugiPhonesimulator/myApp.app 
⁃ Deleted the file from groups and files column in Xcode 
⁃ Deleted the actual file with Finder in <my Xcode projects folder>/myApp/myFile 
⁃ Deleted User/Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app and even <my Xcode projects folder>/myApp/build/debugiPhonesimulator/myApp.app 
⁃ Emptied the trash 
⁃ Verified that there is no reference to the file with Finder spotlight 
⁃ Verified that there is no reference to the file with Xcode search 
⁃ Rebuilt and relaunched the app in simulator 
⁃ Verified that a brand new /Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app has been just created 
⁃ Verified the content of /Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app bundle: the file is still there. Where the h. did Xcode take it from? 

我肯定错过了一些非常明显的东西。任何帮助?

+1

如果不清除或删除构建目录,然后将旧的文件不会被删除。构建过程不会从应用程序包中删除文件,它只会添加它们。 – logancautrell 2011-05-10 18:38:49

+0

顶部答案http://stackoverflow.com/questions/5714372/how-to-empty-caches-and-clean-all-targets-xcode-4有一个更好的解决方案的Xcode 4. – 2011-12-28 23:40:01

回答

6

您是否检查过“目标”节点?如果不是,那么;

  • 展开“目标”节点和应用程序之一。
  • 必须有一个名为“Copy Bundle Resources”的构建阶段。
  • 检查资源是否处于阶段。

您还可以尝试执行完整的项目清理以确保没有临时文件保留。

+0

嗨,洛朗,和感谢您的关注。你的意思是在将文件添加到项目中时选中目标作为选项? – user236739 2010-04-13 14:11:49

+0

好的,解决了。我执行了一个完整的清理(在Xcode构建菜单下)并解决了问题。非常感谢。 – user236739 2010-04-13 15:53:08

+0

这就是诀窍。 Xcode不会跟踪已删除的资源,并将其从常规构建产品中删除;它会逐步增加新的,但删除您必须删除构建产品(或做一个完整的清洗。) – cdespinosa 2010-04-13 16:36:44

1

几天前出现类似问题。

原来,3.2下,模拟器创建了几个应用程序文件夹,每个安装的SDK版本一个。我有:

~/Library/Application Support/iPhone Simulator/3.0 
~/Library/Application Support/iPhone Simulator/3.1.2 
~/Library/Application Support/iPhone Simulator/3.1.3 
~/Library/Application Support/iPhone Simulator/3.2 
~/Library/Application Support/iPhone Simulator/User 

如果您在不同的SDK下编译,它会为新SDK的文件夹内的应用程序创建一个新的应用程序目录。我有一个旧文件夹的别名,最终在Xcode不再定位的应用程序版本中查找错误的文件夹,因此永远不会更改。 IIRC,我必须在匹配的SDK文件夹中追踪新的应用程序。

+0

你好TechZen,感谢您的回答。这是一个好点,但它似乎并没有解决我的问题。事实上,我没有找到没有删除文件的myApp软件包就执行了这样的搜索。更多的,我发现对myApp束具有晚于该文件... – user236739 2010-04-13 14:10:07

+0

Righto的删除的创建日期,该簧介意,因为我只是跑了进去。 – TechZen 2010-04-13 19:13:05

1

我有同样的问题。然而,答案中提出的解决方案并未解决我的问题。 在Targets> Copy Bundle Resources中,我看不到“鬼魂”文件。 我试着做一个完整的清理,删除应用程序并重新安装它,我仍然有我的应用程序中的文件。 我找到的解决方案是通过手动删除文件夹的内容:〜/ Library/Application \ Support/iPhone \ Simulator/4.3/Applications/

2

Clean用于在xcode 3中工作,但似乎没有做我发现从测试设备中删除应用似乎有助于使资源消失。

1

从模拟器中删除应用程序,并在Finder> Developer> Xcode> DerivedData中用finder删除您的应用程序的目录。

1

我遇到了类似的问题。尽管Xcode 4已经从项目中删除,但仍然抱怨缺少资源文件。它会导致构建错误。

这是如何解决的:

1)打开。pbxproj文件 2)删除所有行引用要摆脱 3资源文件)建立它

0

我也有类似的问题,一个.scnassets文件 - 的XCode复制资源只列出.scnassets文件(一个真正的文件夹,而不是一个组),但也会记住并复制它的内容,即使它们已被删除。有意干净的修复了这一点。此外,从鬼删除.scnassets文件显示要复制的文件每次运行应用程序时,在需要的,而不是他们第一次。清理速度提高300%!