简体   繁体   English

plist未复制到应用程序包中

[英]plist not copied into the application bundle

I want to copy a plist into my application bundle with Xcode 4.5.2 (or 4.6). 我想用一个Xcode 4.5.2(或4.6)将一个plist复制到我的应用程序包中。

I select the my.plist, drag it into the project, and make sure its also in the 'Copy Bundle Items' phase in 'Build Phases'. 我选择my.plist,将其拖入项目中,并确保它也在'Build Phases'中的'Copy Bundle Items'阶段。 Nothing red, everything is fine. 没什么红,一切都很好。

When I now compile the project, the my.plist is not copied to the application bundle.I've been trying since hours now. 当我现在编译项目时,my.plist不会被复制到应用程序包中。我已经尝试了几个小时了。

If I now rename the file to my.png, pull the file to Xcode, everything is fine - the my.png file is in the application bundle. 如果我现在将文件重命名为my.png,将文件拉到Xcode,一切都很好 - my.png文件在应用程序包中。

So: why isn't the my.plist file copied to the application bundle but the my.png file? 那么:为什么my.plist文件不是复制到应用程序包而是my.png文件?

Any insight is much appreciated. 任何见解都非常感谢。

EDIT: Thanks for your thoughts! 编辑:谢谢你的想法! It appears to that there is some strange problem with this project. 看来这个项目有一些奇怪的问题。 Any onther (new) project will work as expected here. 任何onther(新)项目都将在此处按预期工作。 By changing the extension from 'plist' to 'plis' everything works fine (well, a workaround I know). 通过将扩展名从“plist”更改为“plis”,一切正常(嗯,我知道的解决方法)。

  • Go to your Project folder 转到Project文件夹
  • Locate your plist 找到你的plist
  • Drag it into your Project (or right-click -> Add files... from Xcode) 将其拖入您的项目(或右键单击 - >从Xcode添加文件...)
  • In the window that will be shown, select "Create groups for any added folders" and Add to targets -> select your Target's name. 在将要显示的窗口中,选择“为任何添加的文件夹创建组”和“添加到目标” - >选择目标的名称。 If you have the pList away from your project folder, select "Copy items into destination group's folder (if needed) 如果pList远离项目文件夹,请选择“将项目复制到目标组的文件夹(如果需要)”
  • Perform a clean build ( command + shift + K ) and clean build folder ( command + alt + shift + K ) 执行一个干净的构建( 命令 + shift + K )并清理构建文件夹( 命令 + alt + shift + K
  • Delete your app from Simulator (or Device) 从模拟器(或设备)中删除您的应用程序
  • Go to your project's targets -> Build phases -> Copy bundle resources -> Click the little "+" in the bottom left corner and make sure your pList is being added there 转到项目的目标 - >构建阶段 - >复制捆绑资源 - >单击左下角的小“+”并确保在那里添加pList
  • Build and run the project to see if it has been successfully copied 构建并运行项目以查看是否已成功复制该项目

Check the target membership of the file if you have more than one target in your project. 如果项目中有多个目标,请检查文件的目标成员身份。 If that doesn't do the trick, copy the actual file into your project's directory via Finder and then add it to the project by selecting "add files to..." from within the Xcode project browser. 如果不能解决问题,请通过Finder将实际文件复制到项目目录中,然后从Xcode项目浏览器中选择“将文件添加到...”将其添加到项目中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM