material-foundation / material-internationalization-ios

MDFInternationalization assists in internationalizing your IOS app or components.
Apache License 2.0
39 stars 34 forks source link

Cocoapods Image not found #21

Closed sschizas closed 7 years ago

sschizas commented 7 years ago

I have the following error coming up when opening interface builder in XCode 9:

IB Designables: Failed to render and update auto layout status for SignUpNameViewController (Qyv-Q3-9tM): dlopen(MaterialComponents.framework, 1): Library not loaded: @rpath/MDFInternationalization.framework/MDFInternationalization Referenced from: MaterialComponents.framework Reason: image not found

Any way to fix it ?

ianegordon commented 7 years ago

Hi @n3trino MaterialComponents recently added a dependency on MDFInternationalization. Have you run pod update recently? I expect it will pull the proper dependency into your workspace.

sschizas commented 7 years ago

@ianegordon i am using 36.3.0 version of Material Components.

ianegordon commented 7 years ago

Hi @n3trino

What version of Xcode are you using? Can you open, build and run the MDCCatalog target from the catalog/MDCCatalog.xcworkspace?

sschizas commented 7 years ago

Hi @ianegordon,

I am using Xcode 9.0.1

When i am running pod update in the catalog folder i get the following error:

`### Command

/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/bin/pod update

Report

Stack

   CocoaPods : 1.3.0
        Ruby : ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
    RubyGems : 2.6.11
        Host : Mac OS X 10.13 (17A405)
       Xcode : 9.0.1 (9A1004)
         Git : git version 2.13.5 (Apple Git-94)
Ruby lib dir : /Users/stavrosschizas/.rvm/rubies/ruby-2.4.0/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 1cd8379818637bbaa6faaa2d9d8aec7647cf4385

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.2.0
cocoapods-try         : 1.1.0

Podfile

workspace 'MDCCatalog.xcworkspace'
project 'MDCCatalog.xcodeproj'

target "MDCCatalog" do
  platform :ios, '8.0'
  project 'MDCCatalog.xcodeproj'
  pod 'MaterialComponentsCatalog', :path => '../'
  pod 'MaterialComponents', :path => '../'
  pod 'CatalogByConvention'

  use_frameworks!
end

target "MDCUnitTests" do
  platform :ios, '8.0'
  project 'MDCUnitTests.xcodeproj'
  pod 'MaterialComponentsUnitTests', :path => '../'
  pod 'MaterialComponents', :path => '../'
  pod 'CatalogByConvention'

  use_frameworks!
end

target "MDCActionExtension" do
  platform :ios, '8.0'
  project 'MDCCatalog.xcodeproj'
  pod 'MaterialComponentsCatalog', :path => '../'
  pod 'MaterialComponents', :path => '../'
  pod 'CatalogByConvention'

  use_frameworks!
end

# EarlGrey configuration
PROJECT_NAME = 'MDCCatalog'
TEST_TARGET = 'MDCEarlGreyTests'
SCHEME_FILE = 'MDCEarlGreyTests.xcscheme'

target TEST_TARGET do
  platform :ios, '8.0'
  project PROJECT_NAME
  inherit! :search_paths
  pod 'EarlGrey', '>= 1.9.3'
  pod 'MaterialComponentsEarlGreyTests', :path => '../'

  use_frameworks!
end

post_install do |installer|
  pod_dir = File.dirname(installer.pods_project.path)

  # Inject our specific warning flags into the .xcconfig files.
  mdc_xcconfigs = [
    "#{pod_dir}/Target Support Files/MaterialComponents/MaterialComponents.xcconfig",
    "#{pod_dir}/Target Support Files/Pods-MDCCatalog/Pods-MDCCatalog.debug.xcconfig",
    "#{pod_dir}/Target Support Files/Pods-MDCCatalog/Pods-MDCCatalog.release.xcconfig",
    "#{pod_dir}/Target Support Files/Pods-MDCUnitTests/Pods-MDCUnitTests.debug.xcconfig",
    "#{pod_dir}/Target Support Files/Pods-MDCUnitTests/Pods-MDCUnitTests.release.xcconfig",
  ]

  # Note the path is relative to the xcconfig file being modified.
  # https://pewpewthespells.com/blog/xcconfig_guide.html
  mdc_xcconfigs.each do |mdc_xcconfig|
    new_xcconfig = File.read(mdc_xcconfig)
    new_xcconfig << "\n#include \"../../../MaterialComponentsWarnings.xcconfig\""
    File.write(mdc_xcconfig, new_xcconfig)
  end

  # EarlGrey configuration
  earl_grey_dir = "#{File.dirname(__FILE__)}/third_party/EarlGrey"
  `git submodule update --init #{earl_grey_dir}`
  load "#{earl_grey_dir}/gem/lib/earlgrey/configure_earlgrey.rb"
  configure_for_earlgrey(installer, PROJECT_NAME, TEST_TARGET, SCHEME_FILE)
end

Error


LoadError - cannot load such file -- /Users/stavrosschizas/Desktop/material-components-ios-develop/catalog/third_party/EarlGrey/gem/lib/earlgrey/configure_earlgrey.rb
/Users/stavrosschizas/Desktop/material-components-ios-develop/catalog/Podfile:72:in `load'
/Users/stavrosschizas/Desktop/material-components-ios-develop/catalog/Podfile:72:in `block (2 levels) in from_ruby'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/gems/cocoapods-core-1.3.0/lib/cocoapods-core/podfile.rb:179:in `post_install!'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.3.0/lib/cocoapods/installer.rb:619:in `run_podfile_post_install_hook'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.3.0/lib/cocoapods/installer.rb:607:in `block in run_podfile_post_install_hooks'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.3.0/lib/cocoapods/user_interface.rb:142:in `message'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.3.0/lib/cocoapods/installer.rb:606:in `run_podfile_post_install_hooks'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.3.0/lib/cocoapods/installer.rb:185:in `block in generate_pods_project'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.3.0/lib/cocoapods/user_interface.rb:64:in `section'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.3.0/lib/cocoapods/installer.rb:182:in `generate_pods_project'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.3.0/lib/cocoapods/installer.rb:119:in `install!'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.3.0/lib/cocoapods/command/update.rb:81:in `run'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.3.0/lib/cocoapods/command.rb:52:in `run'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.3.0/bin/pod:55:in `<top (required)>'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/bin/pod:22:in `load'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/bin/pod:22:in `<main>'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
/Users/stavrosschizas/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'`
ianegordon commented 7 years ago

Hi @n3trino It seems like a couple things might be going wrong.

The error message above seems to be related to material-components-ios' EarlGrey intergration.

LoadError - cannot load such file -- /Users/stavrosschizas/Desktop/material-components-ios-develop/catalog/third_party/EarlGrey/gem/lib/earlgrey/configure_earlgrey.rb

Can you try 'pod install' before 'pod update' ?

As a first step, outside of your project, I recommend: Clone the material-components-ios repo. Get the MDCCatalog app up and running. It's in the main repo under catalog/MDCCatalog.xcworkspace.

If that works as expected, please post your project's podfile here so we can take a look. If that fails (on Earl Grey or MDFInternationalization or anything else), please open an issue in material-components-ios: https://github.com/material-components/material-components-ios

ianegordon commented 7 years ago

Hi @n3trino . I haven't seen a response, so I'm going to optimistically close this issue in the hope that all is working as expected. Please re-open if you are still having problems.

Archie04682 commented 6 years ago

Hi! I have the save problem and it breaks my Storyboard

error: IB Designables: Failed to render and update auto layout status for AddRelocationVC (6mZ-5a-W1W): dlopen(MaterialComponents.framework, 1): Library not loaded: @rpath/MDFInternationalization.framework/MDFInternationalization Referenced from: MaterialComponents.framework Reason: image not found

I'm using Xcode Version 9.4 and MaterialComponents 55.4.0 I can't find solution of this problem. Any Ideas?

nathan-fiscaletti commented 5 years ago

I'm getting this error still today.

$ pod --version
1.8.4
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'CoreDL' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for CoreDL
  pod 'SZTextView'
  pod 'BEMCheckBox'
  pod 'IHKeyboardAvoiding'
  pod 'Charts'
  pod 'MaterialComponents'
  pod 'MDFInternationalization'
  pod 'MaterialComponents/ActivityIndicator'
end
nathan-fiscaletti commented 5 years ago

Doing what was suggested here seems to have fixed this problem for me: https://github.com/CocoaPods/CocoaPods/issues/5334#issuecomment-255831772

Basically, add this to your target in your Podfile.

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings['LD_RUNPATH_SEARCH_PATHS'] = [
      '$(FRAMEWORK_SEARCH_PATHS)'
    ]
  end
end

My podfile now looks like this:

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'CoreDL' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for CoreDL
  pod 'SZTextView'
  pod 'BEMCheckBox'
  pod 'IHKeyboardAvoiding'
  pod 'Charts'
  pod 'MaterialComponents'
  pod 'MDFInternationalization'
  pod 'MaterialComponents/ActivityIndicator'

  post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
      config.build_settings['LD_RUNPATH_SEARCH_PATHS'] = [
        '$(FRAMEWORK_SEARCH_PATHS)'
      ]
    end
  end
end

Once you've modified the Podfile, close out of XCode and run pod install, then open XCode again and clean / build.

MeteC commented 4 years ago

I'm getting the same problem. I just added pod 'MaterialComponents/Tabs' to my podfile, and an MDCTabBar to my storyboard. Every layout in the storyboard produces this error ("Library not loaded: @rpath/MDFInternationalization.framework/MDFInternationalization").

Adding the FRAMEWORK_SEARCH_PATHS workaround to my podfile as per @nathan-fiscaletti simply changed this error to another ("Failed to load designables from path (null)") for my storyboard. This may or may not be exposing another "weak point" in my project setup, but I think sadly I need to bail on bringing the MaterialComponents library into my project just now. (Until it's available via Swift Package Manager?? 😀 🙏 )

nathan-fiscaletti commented 4 years ago

@MeteC you might check https://github.com/CocoaPods/CocoaPods/issues/5334 for more potential solutions.