简体   繁体   English

将执行文件添加到Xcode macOS项目

[英]Add exec file to Xcode macOS project

I'm trying to add exec file with resources to my macOS project. 我正在尝试将包含资源的exec文件添加到我的macOS项目中。 I dragged those files to project, everything compiled successfully and I was enjoying my life. 我将这些文件拖到项目中,一切都成功编译,我过得很愉快。 The problems started when I was trying to launch this exec from the app. 当我尝试从应用程序启动此exec时,问题就开始了。 It failed with error - Can not locate Image / ExifTool.pm . 它因错误而失败- Can not locate Image / ExifTool.pm This error occurred because in project resources are organized with folders (screenshot) , but in compiled project all resources are in the same folder (screenshot) . 发生此错误的原因是,在项目资源中,文件夹是用文件夹组织的(屏幕快照) ,而在已编译项目中,所有资源都在同一个文件夹中(屏幕快照) How can I fix that? 我该如何解决? Thanks. 谢谢。

If I understand the question correctly, you want to control where in your app bundle the resource will end up. 如果我正确理解了这个问题,则您想控制资源在应用程序捆绑包中的哪个位置。

To that, do not include this in your Copy Bundle Resources , but instead create a dedicated Copy Files build phase. 为此,请不要在“ Copy Bundle Resources添加此Copy Files ,而是创建一个专用的“ Copy Files构建阶段。 This will allow you to copy to specific location with your target's bundle. 这将允许您使用目标的捆绑软件复制到特定位置。

However, you should be able find whatever you are after, regardless of where they are copied with the APIs in Bundle . 但是,无论使用Bundle的API将它们复制到何处,都应该能够找到所需的内容。

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

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