5

I after upgrading my iOS to 16.4.1, which required me to upgrade my XCode to 14.3, which required me to upgrade my mac os from 12 to 13, I get this error when trying to build my iOS Flutter app:


Multiple commands produce '/Users//Library/Developer/Xcode/DerivedData/Runner-bczatismiambuefczuntppsiskse/Build/Products/Debug-iphoneos/Runner.app/Frameworks/FBSDKCoreKit.framework'

Target 'Runner' (project 'Runner') has copy command from '/Users//Documents/AndroidStudioProjects//ios/Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64/FBSDKCoreKit.framework' to '/Users/<my-name/Library/Developer/Xcode/DerivedData/Runner-bczatismiambuefczuntppsiskse/Build/Products/Debug-iphoneos/Runner.app/Frameworks/FBSDKCoreKit.framework'

That command depends on command in Target 'Runner' (project 'Runner'): script phase “[CP] Embed Pods Frameworks”


I have NOT added any new packages, pods, plugins whatever... it's just after my iOS and Mac OS (and XCode) updates, that I get this error.

I have checked this stackoverflow question, which didn't help me.

The error messages mention “[CP] Embed Pods Frameworks” so here's a screenshot of that under Build Phases in XCode:

enter image description here

And here's a screenshot of the "Build Phases" > "Copy Bundle Resources" section in my XCode, if that matters. (no Info.plist in there)

enter image description here


My Podfile:

# Uncomment this line to define a global platform for your project
platform :ios, '13.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

#install! 'cocoapods', :disable_input_output_paths => true #didn't work from https://github.com/flutter/flutter/issues/20685

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  
  
  # pods for firebase: //firebase: https://firebase.google.com/docs/ios/setup?authuser=0#available-pods
  # Add the Firebase pod for Google Analytics
  pod 'FirebaseAnalytics'

  # For Analytics without IDFA collection capability, use this pod instead
  # pod ‘Firebase/AnalyticsWithoutAdIdSupport’

  # Add the pods for any other Firebase products you want to use in your app
  # For example, to use Firebase Authentication and Cloud Firestore
  pod 'FirebaseAuth'
  pod 'GoogleSignIn'
  pod 'FBSDKCoreKit' # https://stackoverflow.com/questions/60005793/no-such-module-facebookcore-in-swift-5#answer-61751523
  pod 'FBSDKLoginKit' #<- only this one is mentioned in the docs: https://developers.facebook.com/apps/828723188239449/fb-login/quickstart/?sdk=cocoapods
  pod 'FirebaseFirestore'
  pod 'FirebaseFunctions'
  pod 'FirebaseAppCheck'
  
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
  
#  installer.generated_projects.each do |project|
#    project.targets.each do |target|
#      target.build_configurations.each do |config|
#          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
#       end
#    end
#  end

#  post_install do |installer|
#    installer.pods_project.targets.each do |target|
#      target.build_configurations.each do |config|
#        # drop deployment target so it works with ios14
#        config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
#      end
#    end
#  end
  
#  post_install do |installer|
#    installer.pods_project.targets.each do |target|
#      flutter_additional_ios_build_settings(target)
#      target.build_configurations.each do |config|
#        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
#      end
#    end
#  end

end

My AppDelegate.swift file:

import UIKit
import Flutter

//firebase: https://firebase.google.com/docs/ios/setup?authuser=0#available-pods
import FirebaseCore

import FirebaseAnalytics

import FirebaseAuth
//OAuth:
import GoogleSignIn
//import FacebookCore //from the official docs: https://developers.facebook.com/docs/facebook-login/ios#delegate
import FBSDKCoreKit //correction: https://stackoverflow.com/questions/60005793/no-such-module-facebookcore-in-swift-5#answer-61751523
import FBSDKLoginKit

import FirebaseFirestore
import FirebaseFunctions

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
      
      //from https://firebase.google.com/docs/app-check/flutter/debug-provider?authuser=0&hl=en#apple_platforms
#if DEBUG
    let providerFactory = AppCheckDebugProviderFactory()
    AppCheck.setAppCheckProviderFactory(providerFactory)
#endif
      
    GeneratedPluginRegistrant.register(with: self)
    
    // Use Firebase library to configure APIs
//    FirebaseApp.configure() //-> Exception: Thread 1: "Default app has already been configured."
    if (FirebaseApp.app()==nil){
      FirebaseApp.configure()
    }
    
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Edit: I added additional screenshots showing every file named "Info.plist" within my project (searched via Mac OS Finder).

This first screenshot shows THE main Info.plist file. enter image description here


In this second screenshot, you can see 9 Info.plist files within the same project, but they are all inside Pods:

  • FBSDKCoreKit
  • Google-Mobile-Ads-SDK
  • FBSDKLoginKit
  • GoogleUserMessagingPlatform
  • FBAEMKit
  • FirebaseAnalytics
  • GoogleAppMeasurement
  • FBSDKCoreKit_Basics
  • GoogleAppMeasurement (inside another folder as 2 lines above)

enter image description here

my flutter doctor output:

enter image description here

Cedric
  • 470
  • 6
  • 20
  • Did Your issue solve? @Cedric – Maziar Saadatfar Apr 19 '23 at 10:35
  • asked the same question on apple developer forums: https://developer.apple.com/forums/thread/729378 and on Meta for Developers Community Forum: https://developers.facebook.com/community/threads/242673138418156/?post_id=242673141751489 and added an issue in the github repository for the flutter_facebook_auth plugin: https://github.com/darwin-morocho/flutter-facebook-auth/issues/340 – Cedric May 05 '23 at 06:05
  • I upgraded my Flutter version and suddenly everything works again – Cedric May 09 '23 at 05:21
  • @Cedric can you please give me your flutter version, facebook plugin version and x code version. Bucuse i have upgrade flutter version but still not work. And you have other suggetion please give me. Thanks a lot.... – Jayswal Viraj May 24 '23 at 09:17

1 Answers1

0

First, try to clean the pod:

flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
rm ios/Podfile
flutter run
Q.u.a.n.g L.
  • 1,564
  • 1
  • 12
  • 27