Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XCode 14.3.1 - iOS Build / Run Failed - underlying Objective-C module 'Lottie' not found #2076

Closed
maddy16 opened this issue Jun 13, 2023 · 12 comments

Comments

@maddy16
Copy link

maddy16 commented Jun 13, 2023

I just updated my XCode from 14.2 to 14.3.1 and now my react native application isn't building or running. On Xcode 14.2, everything was working fine.

MacOS Ventura 13.1
Apple Macbook Pro M1 (Silicon)

Wasted a lot of time searching for an appropriate solution, unable to find any.

Here's my Podfile:

`platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
end
target 'MyProject' do
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true


  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios'
  pod 'OpenTok', '2.20.1'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"
  pod 'react-native-branch', path: '../node_modules/react-native-branch'
  use_native_modules!

end

target 'MyProject-tvOS' do

end


pre_install do |installer|
  puts("Image fix for ios14: remove this pre_install script from podfile when upgrading to >= 0.63.3")
  find = "_currentFrame.CGImage;"
  replace = "_currentFrame.CGImage ;} else { [super displayLayer:layer];"
  op = `sed -ie "s/#{find}/#{replace}/" ../node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m`
  puts("Image fix for ios14 done")
end


post_install do |installer|
    puts("Initiating fix for XCode 12.5")
    find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
    "_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
    find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
      "RCTBridgeModuleNameForClass(module))", "RCTBridgeModuleNameForClass([module class]))")
    puts("Fix for XCode 12.5 complete")
    installer.pods_project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
                config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
            end
        end
end

def find_and_replace(dir, findstr, replacestr)
  Dir[dir].each do |name|
      text = File.read(name)
      replace = text.gsub(findstr,replacestr)
      if text != replace
          puts "Fix: " + name
          File.open(name, "w") { |file| file.puts replace }
          STDOUT.flush
      end
  end
  Dir[dir + '*/'].each(&method(:find_and_replace))
end

`

Which Version of Lottie are you using?

"lottie-ios": "3.1.8",
"lottie-react-native": "3.5.0",

Expected Behavior

The build should complete without any errors.

Actual Behavior

image
@calda
Copy link
Member

calda commented Jun 13, 2023

Can you please share a sample Xcode project that demonstrates this issue?

@viktasidenfy
Copy link

viktasidenfy commented Jun 14, 2023

Same here, updated to xCode 14.3 and with commented out use_frameworks! in the podfile I get the same error. Using native iOS project

@maddy16
Copy link
Author

maddy16 commented Jun 14, 2023

I can't use use_frameworks! as it conflicts with some of the libraries like OneSignal. I'll try to spare sometime to prepare an example project to replicate this issue.

@viktasidenfy
Copy link

@maddy16 try adding this to your post_install script. It seems to work for me.

      if target.name == "lottie-ios"
        config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'NO'
      else
        config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
      end

@jonstaff
Copy link

Relevant compiler issue: swiftlang/swift#64669

Ideally, there's a better long-term solution than disabling module interface verification, but for the time being, this works for me in Cocoapods:

  post_install do |installer|
    targets_to_skip_verification = [
      'lottie-ios',
      'lottie-react-native'

      # add others as necessary...
    ]

    installer.pods_project.targets.each do |target|
      if targets_to_skip_verification.include?(target.name)
        target.build_configurations.each do |config|
          puts "Updating OTHER_SWIFT_FLAGS for target #{target.name} to include -no-verify-emitted-module-interface"

          # It's very important that the "$(inherited)" part is added, otherwise this will
          # overwrite all other flags and cause a whole separate set of issues
          config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -no-verify-emitted-module-interface'
        end
      end
    end
  end

@github-actions
Copy link

This issue is stale because it is marked "can't reproduce" and has had no activity in the past week. Please comment with additional information, or this issue will be closed due to inactivity in one week.

@github-actions github-actions bot added the Stale label Jun 28, 2023
@theonetheycallneo
Copy link

theonetheycallneo commented Jun 28, 2023

We are able to reproduce using the latest RN:

package.json
"lottie-react-native": "5.1.6"

Xcode
Version 14.3.1 (14E300c)

@github-actions github-actions bot removed the Stale label Jun 29, 2023
@github-actions
Copy link

github-actions bot commented Jul 6, 2023

This issue is stale because it is marked "can't reproduce" and has had no activity in the past week. Please comment with additional information, or this issue will be closed due to inactivity in one week.

@github-actions github-actions bot added the Stale label Jul 6, 2023
@hungnd6282
Copy link

if target.name == "lottie-ios"
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'NO'
else
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end

same me

@github-actions github-actions bot removed the Stale label Jul 11, 2023
@github-actions
Copy link

This issue is stale because it is marked "can't reproduce" and has had no activity in the past week. Please comment with additional information, or this issue will be closed due to inactivity in one week.

@umerdogar
Copy link

Has anyone resolved this, i am getting the same in my Xcode 15.2

@gratefulHeart
Copy link

Relevant compiler issue: apple/swift#64669

Ideally, there's a better long-term solution than disabling module interface verification, but for the time being, this works for me in Cocoapods:

  post_install do |installer|
    targets_to_skip_verification = [
      'lottie-ios',
      'lottie-react-native'

      # add others as necessary...
    ]

    installer.pods_project.targets.each do |target|
      if targets_to_skip_verification.include?(target.name)
        target.build_configurations.each do |config|
          puts "Updating OTHER_SWIFT_FLAGS for target #{target.name} to include -no-verify-emitted-module-interface"

          # It's very important that the "$(inherited)" part is added, otherwise this will
          # overwrite all other flags and cause a whole separate set of issues
          config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -no-verify-emitted-module-interface'
        end
      end
    end
  end

Relevant compiler issue: apple/swift#64669

Ideally, there's a better long-term solution than disabling module interface verification, but for the time being, this works for me in Cocoapods:

  post_install do |installer|
    targets_to_skip_verification = [
      'lottie-ios',
      'lottie-react-native'

      # add others as necessary...
    ]

    installer.pods_project.targets.each do |target|
      if targets_to_skip_verification.include?(target.name)
        target.build_configurations.each do |config|
          puts "Updating OTHER_SWIFT_FLAGS for target #{target.name} to include -no-verify-emitted-module-interface"

          # It's very important that the "$(inherited)" part is added, otherwise this will
          # overwrite all other flags and cause a whole separate set of issues
          config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -no-verify-emitted-module-interface'
        end
      end
    end
  end

it works for me ! good!!!!

podspec

s.pod_target_xcconfig = {
'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'NO',
'OTHER_SWIFT_FLAGS' =>'$(inherited) -no-verify-emitted-module-interface',
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants