Chief Madog
Chief Madog

Reputation: 1507

Library not loaded on application after adding framework

I have 2 targets, my actual application and my Framework (that has some screens and logic inside of it)

enter image description here

As ive seen done in many tutorials, i'm initialising the framework screens by calling the first screen in the framework:

let frameworkBundle = Bundle(for: HomeViewController.self)
        let storyboard = UIStoryboard.init(name: "Main", bundle: frameworkBundle)
        window?.rootViewController = storyboard.instantiateInitialViewController()
        window?.makeKeyAndVisible()

Everything builds up fine, but before the actualy application can load up i get an error saying :

Library not loaded

Here is my Podfile:

target 'TriageFramework' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  pod 'PhoneNumberKit', '~> 2.5'
  pod 'Fabric'
  pod 'SwiftKeychainWrapper'
  pod 'Crashlytics'
  pod 'SVProgressHUD'

  target 'Virtual First' do
    inherit! :search_paths
  end


end

Here is the full error message:

dyld: Library not loaded: @rpath/PhoneNumberKit.framework/PhoneNumberKit
  Referenced from: /var/containers/Bundle/Application/9DC8D338-6DD7-4CCA-8FD5-804DD00FE015/Virtual First.app/Virtual First
  Reason: no suitable image found.  Did find:
    /private/var/containers/Bundle/Application/9DC8D338-6DD7-4CCA-8FD5-804DD00FE015/Virtual First.app/Frameworks/PhoneNumberKit.framework/PhoneNumberKit: mach-o, but wrong architecture
    /private/var/containers/Bundle/Application/9DC8D338-6DD7-4CCA-8FD5-804DD00FE015/Virtual First.app/Frameworks/PhoneNumberKit.framework/PhoneNumberKit: mach-o, but wrong architecture
    /private/var/containers/Bundle/Application/9DC8D338-6DD7-4CCA-8FD5-804DD00FE015/Virtual First.app/Frameworks/PhoneNumberKit.framework/PhoneNumberKit: mach-o, but wrong architecture

What am i doing wrong ?

Upvotes: 0

Views: 473

Answers (1)

Daljeet
Daljeet

Reputation: 1595

Delete derive data and clean the project. Run now.

Upvotes: 1

Related Questions