iosswiftreact-nativeazure-communication-services

AzureCommunicationCalling iOS sdk does not have support for Apple Swift version 6.0.2 effective-5.10 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)


I am trying to integrate AzureCommunicationCalling iOS sdk in my react native project. but when i try to import AzureCommunicationCalling in a swift file, build error occurs.

Failed to build module 'AzureCommunicationCalling'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55)', while this compiler is 'Apple Swift version 6.0.2 effective-5.10 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)'). Please select a toolchain which matches the SDK.

Is there any workaround for this? I tried to do the following:

  1. Downgrade my Xcode version to 15.1 (I get a different error Failed to build module 'AzureCommunicationCalling' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug)
  2. Set Build Libraries For Distribution to YES in Build Settings (In this case the error goes away but i get a different error saying Using bridging headers with module interfaces is unsupported)
  3. Created a new react native project and tried to integrate the sdk. (Same error)

This is my Podfile

def node_require(script)
  # Resolve script with node to allow for hoisting
  require Pod::Executable.execute_command('node', ['-p',
    "require.resolve(
      '#{script}',
      {paths: [process.argv[1]]},
    )", __dir__]).strip
end

node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')

platform :ios, 13.4
prepare_react_native_project!

setup_permissions([
  'LocationAccuracy',
  'LocationAlways',
  'LocationWhenInUse',
  'Notifications',
])

use_frameworks! :linkage => :static

abstract_target 'myProjectCommonPods' do
  pod 'react-native-google-maps', :path => '../node_modules/react-native-maps'
  config = use_native_modules!
  
  use_react_native!(
    :path => config[:reactNativePath],
    :app_path => "#{Pod::Config.instance.installation_root}/..",
    :hermes_enabled => false
  )

  pod 'AzureCommunicationCalling', '~> 2.13.1'

  target 'myProject Dev' do
    $RNFirebaseAsStaticFramework = true
  end

  target 'myProject Live' do
    $RNFirebaseAsStaticFramework = true
  end

  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false
  pod 'react-native-webview', :path => '../node_modules/react-native-webview'
  pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'
  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
  pod 'react-native-slider', :path => '../node_modules/@react-native-community/slider'
  pod 'RNSVG', :path => '../node_modules/react-native-svg'
  pod 'react-native-geolocation', :path => '../node_modules/@react-native-community/geolocation'

  target 'myProjectTests' do
    inherit! :complete
    # Pods for testing
  end

  pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
    
    installer.pod_targets.each do |pod|
      if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
        def pod.build_type;
        Pod::BuildType.static_library
      end
    end
    if pod.name.start_with?('AzureCommunicationCommon') || pod.name.start_with?('AzureCommunicationCalling')
      def pod.build_type;
      Pod::BuildType.new(:linkage => :dynamic, :packaging => :framework)
    end
  end
  end
end

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "$(inherited) arm64"
      if config.name == 'Debug'
        config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
      end
    end
  end
end

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignalXCFramework', '>= 5.0.0', '< 6.0'
end

target 'OneSignalNotificationServiceExtensionLive' do
  pod 'OneSignalXCFramework', '>= 5.0.0', '< 6.0'
end

I am using

  1. Xcode version 16.1
  2. AzureCommunicationCalling iOS sdk version 2.13.1
  3. React native version 0.74.4

I was trying to build react native app on a react iPhone device (iOS version 17.6.1).


Solution

  • As per the github link which shared earlier, You need to change the minimum deployment target to 16.0 to fix your issue.

    The issue is due to with AzureCommunicationCalling SDK in React Native .

    You can resolve this issue by adjusting the minimum deployment target to iOS 16.0 for your project .

    To do this, you can change the deployment target as follows:

    platform :ios, '16.0'
     
    

    Thank @fahimjubayer-dsi for the git link. Refer to GitHub for Azure SDK for iOS.

    After making this change, run again to update the dependencies and then rebuild your project.