问题描述
我正在编写一个tvOS应用程序.到目前为止,我正在使用原型OS X应用程序将代码开发为OS X框架.
I am writing a tvOS app. Up to now I was developing the code as an OS X framework with a prototyping OS X app.
现在,我想将生产tvOS应用程序添加到组合中,保留OS X原型.这意味着我需要同时为OS X和tvOS构建的框架.原则上这应该不是问题,因为我只使用两个平台上都可用的框架.
Now I would like to add the production tvOS app into the mix, keeping the OS X prototype. Which means I need the framework to be built both for OS X and tvOS. This should not be a problem in the principle, since I only use frameworks available on both platforms.
是否可以构建跨平台框架?我要使用什么设置?
Is it possible to build a cross-platform framework? What settings do I use?
推荐答案
是的,这很常见.创建一个新的以tvOS为目标的Xcode目标,并添加与OSX目标相同的源文件.
Yes it's commonly done. Create a new Xcode target, targetting tvOS, and add the same source files as the OSX target.
如果需要在编译时包含/排除/更改代码或行为,则需要#import <TargetConditionals.h>
.
If you need to include/exclude/change code or behaviour at compile time then you need to #import <TargetConditionals.h>
.
这篇关于我可以有一个适用于OS X和tvOS的跨平台框架吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!