自iOS 8引入嵌入式二进制文件以来,我一直希望将大量常用代码移植到框架中。我决定等一年才做到这一点,而今年,凭借Xcode 7 Beta和iOS 9,我就开始这么做了。
Ever since Embedded Binaries were introduced in iOS 8, I have been wanting to port a lot of my common code into frameworks. I decided to wait one year before doing it and this year, with Xcode 7 Beta and iOS 9, I'm starting to do that just that.
我已经开始了Xcode 7中的Cocoa Touch框架项目,我想将其编译成可用的框架。我可以把它编译成.framework,但是有一些问题;也就是说,框架似乎不可导入新项目(我将简要描述我为此所做的步骤)。因此,我不确定我的框架是否有任何可见符号。
I have started a Cocoa Touch framework project in Xcode 7 and I want to compile it into a usable framework. I can get it to compile my project into a .framework, but there's a few issues; namely, the framework doesn't appear to be importable into new projects (I will describe the steps I did for that shortly). Because of that, I'm not sure if my framework has any visible symbols.
这是我创建框架所做的:
This is what I have done to create the Framework:
这就是我尝试添加的内容新项目的框架:
And this is what I did to try to add the framework to a new project:
不幸的是,尽管嵌入式框架已经存在了大约一年,我找不到关于这个主题的文章。
Unfortunately, despite the fact that embedded frameworks have been around for around a year, I can't find much writing on the topic.
所以我的问题是:我是否正确地创建了框架,使我的框架/其他任何东西都失败了一个Xcode 7 Beta错误?或者是否有不同的过程来创建我想用作嵌入式二进制文件的框架?我应该提一下,我想让这个库开源,我想将一个简单的 .framework 文件分发给想要使用它的人会很整洁。
So my question is: Am I creating the framework correctly, making it possible that my framework/anything else is failing due to an Xcode 7 Beta bug? Or is there a different procedure to create a framework that I want to use as an Embedded Binary? I should probably mention that I want to make this library open source, and I think distributing a plain .framework file to the people who want to use it would be neat.
推荐答案我在Xcode 7上遇到了同样的问题。我通过编辑项目的构建设置解决了这个问题。其中包括框架)。
I Had the same issue on Xcode 7. I solved it by editing the build settings of the project (the one which includes the framework).
将框架搜索路径字段设置为 $(PROJECT_DIR)或包含.framework文件的目录的路径,它应该帮助Xcode找到模块。
By setting the Framework Search Paths field to $(PROJECT_DIR) or to the path to the directory that contains the .framework file it should help Xcode finding the module.
更多推荐
使用Xcode 7(Beta 3)构建Swift框架以用作嵌入式二进制文件
发布评论