iosframeworksstatic-librariesstatic-linkingdynamic-library

iOS Static vs Dynamic frameworks clarifications


I have to admit that with the release of iOS 8 I am a bit confused about dynamic and static frameworks in iOS.

I am looking for a way to distribute a library that I created, and I need to support iOS 7 and above. (Note: This will be a proprietary framework. I cannot use cocoa pods, and I also cannot distribute the source). Here is what I already know:

And here are my questions regarding this information:


Solution

  • Before iOS8, Xcode only allowed the option of creating static libraries for iOS. The common problem with that was we had to ship the binary and headers separately.

    Later, some developers came with the idea of creating 'static frameworks'. [the .framework is just a folder with symbolic links to the lib and the headers]. One such example is https://github.com/jverkoey/iOS-Framework

    This option will work for iOS 7 or 8 or before that. Because they are just static libraries with the convenience of bundling the headers files along.

    As for your questions of the resources, we would need to bundle them in '.bundle'.. For shipping them i am not sure if we can enclose them in the .framework folder.. In the past i used to ship my libs as a static framework and bundle...

    However the above option will not work for you if you use Swift. Xcode does not support building static libraries that include swift code.

    You must go with Dynamic frameworks if there is swift usage. In theory, Dynamic frameworks work in iOS7.. But, i think iTunes Connect will reject if the app is targeting iOS7 and uses Dynamic frameworks :-).

    Hope this helps