iOS is it a static or a dynamic framework? iOS is it a static or a dynamic framework? ios ios

iOS is it a static or a dynamic framework?


It can be either.

Only iOS8+ will allow dynamic frameworks in the app bundle, however.

The way to find out is to look in the .framework and use the file command on the main file:

$ cd iOS/Crashlytics.framework$ ls -ltotal 9984-rwxr-xr-x  1 andy  staff  4710656 11 Sep 17:11 Crashlyticsdrwxr-xr-x  8 andy  staff      272 11 Sep 17:11 Headers-rw-r--r--  1 andy  staff     1553 11 Sep 17:11 Info.plistdrwxr-xr-x  3 andy  staff      102 11 Sep 17:11 Modules-rwxr-xr-x  1 andy  staff   146164 11 Sep 17:11 run-rwxr-xr-x  1 andy  staff   241688 11 Sep 17:11 submit$ file Crashlytics Crashlytics: Mach-O universal binary with 5 architecturesCrashlytics (for architecture armv7):   current ar archive random libraryCrashlytics (for architecture armv7s):  current ar archive random libraryCrashlytics (for architecture i386):    current ar archive random libraryCrashlytics (for architecture x86_64):  current ar archive random libraryCrashlytics (for architecture arm64):   current ar archive random library

Where ar archive means "static library".

Alternatively, a "dynamic" framework will look like this and explicitly state that it's dynamically linked.

$ cd /Library/Frameworks/iTunesLibrary.framework/$ ls -ltotal 40lrwxr-xr-x  1 root  wheel   24 10 Sep 17:38 Headers -> Versions/Current/Headerslrwxr-xr-x  1 root  wheel   24 10 Sep 17:38 Modules -> Versions/Current/Moduleslrwxr-xr-x  1 root  wheel   26 10 Sep 17:38 Resources -> Versions/Current/Resourcesdrwxr-xr-x  4 root  wheel  136 10 Sep 17:41 Versionslrwxr-xr-x  1 root  wheel   22 10 Sep 17:38 XPCServices -> Versions/A/XPCServiceslrwxr-xr-x  1 root  wheel   30 10 Sep 17:38 iTunesLibrary -> Versions/Current/iTunesLibrary$ file Versions/Current/iTunesLibrary Versions/Current/iTunesLibrary: Mach-O universal binary with 2 architecturesVersions/Current/iTunesLibrary (for architecture i386): Mach-O dynamically linked shared library i386Versions/Current/iTunesLibrary (for architecture x86_64):   Mach-O 64-bit dynamically linked shared library x86_64


I use this command to list all STATIC Frameworks from a path with a list of frameworks:

find -E . -type f -iregex ".*\.framework\/[^./]*" -exec file {} \; | grep ': current ar archive' | sed 's/.*\/\(.*.framework\).*/\1/'