我们有一个对任何 iOS 开发人员都非常有帮助的框架或库的想法.因此,我们正在认真考虑从应用开发转向框架/库开发.
We have an idea for an framework or library that will be very helpful for any iOS developer. So we're seriously thinking about switching from app development to framework/library development.
但是当我们想要为库/框架收费时,我们必须以某种方式保护代码.我们如何构建一个框架,让我们框架的用户看不到源代码,就像我们看不到苹果框架的源代码一样?我猜他们只提供头文件和一些带有编译框架的奇怪的 Unix exe 文件.
But when we want to charge for the library/framework, we must protect the code somehow. How can we build a framework in such a way that the user of our framework can't see the source code, similar to how we can't see the source code of Apples frameworks? They only ship the header files and some weird Unix exe file with the compiled framework, I guess.
或者,如果无法制作其他 iOS 开发人员可以在不复制和粘贴我们的源代码的情况下使用的编译框架/库,那么有没有办法混淆 Objective-c 代码?
Or if it is not possible to make an compiled framework / library that other iOS developers can use without beeing able to copy&paste our source codes, then is there a way to obfuscate the objective-c code?
是的,可以构建框架,让框架的用户看不到源代码.
Yes, it is possible to build frameworks so the user of the framework can't see the source code.
查看这些文章(我过去成功使用第一篇创建框架——后面的文章是对原始文章的更新):
Check out these articles (I've successfully used the first one to create frameworks in the past -- the later articles are updates to the original):
http://www.drobnik.com/touch/2010/04/making-your-own-iphone-frameworks/
http://www.drobnik.com/touch/2010/05/making-your-own-iphone-frameworks-in-xcode/
http://www.drobnik.com/touch/2010/10/embedding-binary-resources/
要使用该框架,您的用户只需将 .framework 包拖到 Xcode 中即可.他们将能够看到您复制到包中的头文件(请参阅上面的文章),但看不到源文件(因为它不包括在内 - 只有编译后的输出在包中).
To use the framework, your users would just drag the .framework bundle into Xcode. They will be able to see the header files you copy into the bundle (see the articles above), but not the source (as it's not included -- only the compiled output is in the bundle).
这也是分发用于公司内多个项目的代码的好方法.
This can also be a great way to distribute code that is used for multiple projects within your company.
查看下面添加的无羽链接——它是最新的,并且都在一个页面上:http://github.com/jverkoey/iOS-Framework.它还列出了其他几种方法的问题.这是我现在在尝试记住设置新框架时要做什么时遵循的指南.:)
Check out the link featherless added below -- it is much more recent and all on one page: http://github.com/jverkoey/iOS-Framework. It also lays out the issues with several other approaches. This is the guide I now follow when trying to remember what to do when setting up a new framework. :)
有一个选项,正是您正在寻找的:iOS 通用框架
!
There is a option, exactly that you a re looking for:
Universal Framework for iOS
!
其他人可以看到我的代码吗? 答:不会.此框架将导出已编译的二进制文件,因此任何人都可以看到其中的内容.您可以对其他一些文件进行相同的处理,例如 XIB.
Will be my code visible to others? A: No. This Framework will export a compiled binary, so anyone can see inside it. You can make the same for some other files, like XIBs.
我为什么需要这个? 答:这适用于希望在不显示整个代码(.m/.c/.cpp 文件)的情况下共享其代码的开发人员/团队.此外,这适用于那些想要将编译后的代码 + 资源(图像、视频、声音、XIB、plist 等)组织到一个地方的人.这也适用于希望在同一基础(框架)之上合作的团队.
Why I need this? A: This is for developers/teams that want to share their codes without shows the entire code (.m/.c/.cpp files). Besides this is for who want to organize compiled code + resources (images, videos, sounds, XIBs, plist, etc) into one single place. And this is also for that teams that want to work together above the same base (framework).
(c) http://blog.db-in.com/Universal-framework-for-ios/
这篇关于如何以安全的方式为其他开发人员构建框架或库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!