Can I have a cross-platform framework for OS X and tvOS?

空扰寡人 提交于 2019-12-10 23:24:59

问题


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.

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?


回答1:


Yes it's commonly done. Create a new Xcode target, targetting tvOS, and add the same source files as the OSX target.

If you need to include/exclude/change code or behaviour at compile time then you need to #import <TargetConditionals.h>.



来源:https://stackoverflow.com/questions/33920865/can-i-have-a-cross-platform-framework-for-os-x-and-tvos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!