开发者

load XML in iPhone App

I have a problem.

I have a XML and a project (XCode 4.1). I must build my app with a XML file into this. Now, where i put a XML file in my project?

In the XCode 3 there is a resource folder but now开发者_如何转开发 i haven't this.

Thanks


There should be a Supporting Files folder in your project. You might organize any extra files in this space.


You can put the XML file anywhere you like, so long as you subsequently make Xcode aware of its whereabouts. However, the most straightforward way is probably as follows:

  1. Either:
    • Make a new group by going to File->New->New Group or
    • Use the existing Supporting Files group.
  2. Drag the XML file into the group. Xcode will then present an add file sheet. Make sure that "Copy items into destination group's folder (if needed)" option is selected and your target is checked in the "Add to targets" list. Click "Finish".

That's it. Xcode should automatically add the file to the project and include it in your app's bundle.

Should you need to add the file "manually", you can select your project in the Project section of the Navigator pane (press Cmd-1 and select your project at the top left), select your target in the list (just to the right), select "Build Phases" from the tabs at the top and add the file to the "Copy Bundle Resources" build phase.


Just put it in Supporting files group.

I think this should help you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜