开发者

how to organize resources in xcode

I'm using XCode4, and I have about 1000 audio files included in my application. Every time I switch to "Build Phases" tab 开发者_运维百科for the target, it takes a few seconds because of all the items in the "Copy Bundle Resources" phase (even if it's not expanded). I have several targets like this, and I plan on doubling or tripling the number of audio files in each.

Does anyone have any suggestions as to how I can organize this so the lag doesn't happen? Would something like putting those resources in a separate target that makes a bundle work?


Remove all your audio files from the Xcode project. Then put them all in a single folder (e.g. 'audio'), and drag that folder to the Xcode project, making sure that you select "Create folder references to any added folder" instead of the default "Create groups for any added folders".

That will create a reference to the added folder, instead of a group with references to every single audio file. Referenced folders in Xcode have a blue shade instead of the typical yellow one. You will see that only the 'audio' folder has been added to the copy bundle resources phase, instead of all individual audio files. Two catches:

1) The audio files inside this folder will now be stored on /audio, so you may need to specify the full path when handling them in your code.

2) Xcode 3 would sometimes not detect changes (added, updated or removed files) inside referenced folders. Xcode 4 is much better at this but once in a while you might need to clean and rebuild if you detect the updated resources aren't being transferred to the simulator or testing device.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜