开发者

Can separate .pbxuser and .mode1v3 files cause xCode to lose track of resources?

We are working on a two-person iOS project using svn to sync our code. Recently we discovered a problem when compiling on one machine but not on the other. The discrepancy occurred even when checking out the latest revision to a fresh directory; on my co-workers machine the code would run fine, and on mine it would fail.

We are running xCode Version 3.2.5 on identical machines. The only differen开发者_高级运维ce I can think of is that we have .pbxuser and .mode1v3 with each of our usernames, and both sets of these were in the svn repository.

We finally tracked the problem down to this line of code,

return [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat: @"animation-human-%d", aniType] ofType:@"dimp"];

which was failing and returning nil on my machine. However, the rogue file was present in svn, in xCode's groups and files viewer, and after removing it from xCode by reference and then adding it back as an existing file, the problem was solved.

It's very frustrating to solve the problem like this without really understanding what caused it. My understanding from digging around is that the .pbxuser and .mode1v3 files are just per-user preferences. Can it be that a problem in this file was causing xCode to lose my animation file? Should we take these files out of svn, or use a single file that is renamed and shared between users?

Any explanation would be greatly appreciated. Thanks in advance.


I don't think it's anything to do with those files.

My best guess is that at some point, one of you accidentally removed the file from the target, meaning it wouldn't have been installed when running your app. During development, files in your bundle stick around, so it wouldn't have caused any immediate problems.

Then, later, you deleted the app from your device / the simulator. A fresh install wouldn't have installed the file, hence the crash, even though the file is in your project and even though it works for your co-worker.

Removing the file from your project and then re-adding it would have re-added it to your target as well, solving the problem. You can check if this is what happened by checking out an older version from immediately before you fixed things, right-clicking on the file, selecting Get Info, and seeing if the target is ticked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜