Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dyld: Library not loaded: @rpath/FMDB.framework/FMDB

I am using Xcode 7.2 and swift 2. Deployment target is ios 9.0

The question is similar to many previous questions being asked, but my issue is not common or did not find any reference to any of them.

I have created a cocoa touch framework for iOS which has mixed code ( both swift and objC) and has some libraries included from Cocoapods. ( FMDB, ObjectMapper, HockeySDK )

I have another target in the same project which has a sample application where I include my framework. Now, when I try to run it on my device it throws me this runtime error just after installation,

dyld: Library not loaded: @rpath/FMDB.framework/FMDB Referenced from: /private/var/mobile/Containers/Bundle/Application/0A768355-B7F9-4B1C-AE0D-D2ED57A7E1D6/SwiftExample.app/Frameworks/MyFramework.framework/MyFramework Reason: image not found.

I have tried all these actions:

  • Restarting Xcode, iPhone, computer
  • Clean & Build, project
  • Runpath Search Paths is '$(inherited) @executable_path/Frameworks'
  • Embedded Content Contains Swift Code is 'Yes'

My PodFile has the following desc :

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

platform :ios, '9.0'

xcodeproj 'MyFramework'

target :'MyFramework' do
    pod 'HockeySDK', '~> 3.8.4'
    pod 'FMDB'
    pod 'OpenSSL-iOS', '~> 1.0'
    pod 'GoogleAnalytics'
    pod 'ObjectMapper', '~> 1.0'
end

Is there something I am missing or doing wrong ?

like image 689
Shane D Avatar asked Mar 04 '26 18:03

Shane D


1 Answers

I had the same problem this morning. I solved it by (1) compiling the FMDB framework in statically-linked, not dynamically-linked, mode; and (2) adding the link to "libsqlite3.dylib" library in the frameworks section of my application program.

To do (1), in XCode, open the FMDB framework project, and in the Project editor, under the framework's Build Settings tab, in the Linking subsection, change the Mach-O Type to Static Library, and re-build the framework.

To do (2), again in XCode, open your application project, and in the Project editor, under the application's General tab, in the "Linked Frameworks and Libraries" subsection, add "libsqlite3.dylib".

like image 127
arjuna Avatar answered Mar 06 '26 09:03

arjuna



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!