Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build a framework or library for other developers, the secure way? [closed]

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.

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.

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?

like image 406
Proud Member Avatar asked Oct 31 '10 20:10

Proud Member


People also ask

How are frameworks developed?

Derive frameworks from existing problems and solutions. Develop small, focused frameworks. Build frameworks using an iterative process driven by client participation and prototyping. Treat frameworks as products by providing documentation and support, and by planning for distribution and maintenance.

How do you distribute a framework?

Distributing compiled framework through CocoapodsCreate a git repository to hold Cocoapods specifications files in our home directory. Create a git repository in our home directory to hold the compiled MyFramework. Create and push MyFramework specification to our Cocoapods specification repository created in step 1.

What is the difference between library and framework?

Libraries provide developers with predefined functions and classes to make their work easier and boost the development process. Framework, on the other hand, is like the foundation upon which developers build applications for specific platforms.

What is XC framework?

What is XCFramework? Apple defines XCFrameworks as a distributable binary package created by Xcode that contains variants of a framework or library so that it can be used on multiple platforms (iOS, macOS, tvOS, and watchOS), including Simulator builds.


1 Answers

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/

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.


Update:

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. :)

Update2 (with Xcode 6 release)

There is a option, exactly that you a re looking for: Universal Framework for iOS!

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.

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/

like image 136
Jay Peyer Avatar answered Oct 12 '22 03:10

Jay Peyer