In ios, I don't understand why some libraries need to be embedded (like WebRTC
) and some other not (like facebook
)?
Asked
Active
Viewed 120 times
1 Answers
1
Facebook's frameworks are static libraries. This is a bit unusual in iOS; most things are dynamic libraries. Static libraries are linked at build time rather than at load time, so you don't need to embed them.

Rob Napier
- 286,113
- 34
- 456
- 610
-
thanks! Do you how to embed (manually) in a project (not made with xcode) a dynamic library? Do we just need to deploy the library with the app ? – zeus Dec 04 '18 at 22:40
-
If you're building them by hand, then you'll need to put the library in the directory you linked it to (relative to the @rpath). That's usually in Frameworks, but it depends on how you're building your app. `otool -L` on the app will tell you where it expects to load the library from. – Rob Napier Dec 05 '18 at 14:29
-
I just did it, otool -L ALLiveVideoChatClient.app/ALLiveVideoChatClient return me: @rpath/WebRTC.framework/WebRTC (compatibility version 0.0.0, current version 0.0.0) .... what is the value of @rpath ? I did like you say, put the library in Frameworks (ALLiveVideoChatClient.app/Frameworks/WebRTC.framework/WebRTC) but it's always failed at load time with: @rpath/WebRTC.framework/WebRTC : image not found :( so maybe my rpath is not good, but how to update it from the linker ? – zeus Dec 05 '18 at 14:45
-
i always receive this error: DYLD, Library not loaded: @rpath/WebRTC.framework/WebRTC | Referenced from: /var/containers/Bundle/Application/E60EAD9F-0CB6-4B13-80B3-3ED71B562BAB/ALLiveVideoChatClient.app/ALLiveVideoChatClient | Reason: image not found but i copy well the library in ALLiveVideoChatClient.app/Frameworks/WebRTC.framework/WebRTC so what i did wrong ? Maybe i need to set the @rpath? how to check it's value ? – zeus Dec 05 '18 at 14:50
-
https://stackoverflow.com/questions/24045633/dyld-library-not-loaded-error/24108382#24108382 If you're having trouble linking, you'll want to open a new question explaining how you're building and what problems you're encountering. – Rob Napier Dec 05 '18 at 15:06
-
Thanks rob! last question, you probably know the answer, I just find a way to print the value of rpath and it's show me: $ORIGIN. do you know what it's mean ? – zeus Dec 05 '18 at 15:13
-
$ORIGIN is the path to the binary (generally the executable), after resolving all symlinks. – Rob Napier Dec 05 '18 at 15:34
-
as you requested, I create a new question here: https://stackoverflow.com/questions/53640481/how-to-manually-include-a-dynamic-library-in-an-ios-app please help me, you seem to be very strong and I m lost :( – zeus Dec 05 '18 at 20:48