创建Cocoa框架 [英] Creating a Cocoa Framework

查看:81
本文介绍了创建Cocoa框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个工作的Cocoa框架,我希望重新分发。然而问题是,它不会在Xcode外部运行。我已经读了一些关于 @executable_path /../ Frameworks ,我没有包括,因为我不知道放在哪里:/



因此,我在Xcode中使用 DYLD_FRAMEWORK_PATH 变量运行我的应用程序工作正常,但只在Xcode中 - 如果我试图运行它它自己会立即崩溃,并说 IMAGE NOT FOUND



我确定 @executable_path /../ Frameworks 是什么缺失,但我不知道放在哪里。



任何人都可以帮助我? :)



感谢

解决方案

$ b $

$

b
  • 将框架添加到应用程序的Xcode项目中。添加复制文件构建阶段,在目标弹出框中选择框架,并确保添加了框架,以便在构建时将其复制到应用程序的Frameworks目录中。


  • 最后,在您的项目设置中,将@loader_path /../ Frameworks添加到Runpath搜索路径。



  • I've created a working Cocoa framework which I wish to redistribute. The problem is however, it won't run outside of Xcode. I've read something about @executable_path/../Frameworks, which I did not include, because I don't know where to put it :/

    Therefore I run my app in Xcode using the DYLD_FRAMEWORK_PATH variable which works fine, but only in Xcode - if I try to run it on its own it crashes straight away and says IMAGE NOT FOUND.

    I'm sure @executable_path/../Frameworks is what's missing, but I don't know where to put it.

    Could anyone help me out please? :)

    Thanks

    解决方案

    Here is how I usually manage things:

    1. In the framework's Xcode project, set the Installation Directory to @rpath

    2. Add the framework to your application's Xcode project. Add a Copy Files build phase, select Frameworks in the Destination popup, and ensure your framework is added so it will be copied to your application's Frameworks directory when it is built.

    3. Finally, in your project's settings, add @loader_path/../Frameworks to Runpath Search Paths.

    这篇关于创建Cocoa框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆