OneSignal-Flutter-SDK icon indicating copy to clipboard operation
OneSignal-Flutter-SDK copied to clipboard

[question]: Getting error Multiple commands produce and There is no XCFramework found at...

Open wahyu-handayani opened this issue 3 months ago • 1 comments

How can we help?

I am using onesignal_flutter: ^5.3.4 and getting error:

Error (Xcode): Multiple commands produce '/myproject/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/OneSignalExtension.framework'

Error (Xcode): There is no XCFramework found at '/myproject/ios/Pods/iOS_SDK/OneSignalSDK/OneSignal_Core/OneSignalCore.xcframework'.

here is my pod file

# Uncomment this line to define a global platform for your project
platform :ios, '15.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

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  pod 'Firebase/Core'

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

$iOSVersion = '12.0'

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=*]"] = "armv7"
    config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $iOSVersion
    config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',
        'PERMISSION_NOTIFICATIONS=1'
      ]
  end

  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      # config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
      #   '$(inherited)',ication
      #   'PERMISSION_NOTIFICATIONS=1'
      # ]
    xcconfig_path = config.base_configuration_reference.real_path
    xcconfig = File.read(xcconfig_path)
    xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
    File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
      if Gem::Version.new($iOSVersion) > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $iOSVersion
      end
    end
    # target.build_configurations.each do |config|
    #   config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
    #   config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
    #     '$(inherited)',
    #     # 'PERMISSION_CAMERA=0',
    # ]
    # end
  end
end

I have tried to add this part

target 'OneSignalNotificationServiceExtension' do
  use_frameworks!
  pod 'OneSignalXCFramework', '>= 5.0.2', '< 6.0.0'
end

but still get the same error. so I remove that. I also open this question in

https://stackoverflow.com/questions/79721988/there-is-no-xcframework-found-at-when-installing-onesignal-in-flutter-project

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

wahyu-handayani avatar Aug 01 '25 02:08 wahyu-handayani