简体   繁体   中英

how can i install the plugin cordova-plugin-iosrtc on a ionic capacitor project

I am trying to use getUserMedia to get the stream of the camera. For that I understood, it is impossible because this function is not yet implemented in ios 14.4 or at least not authorized.(error not allowed)

So I saw that the only way to get the stream is to use this cordova plugin below: https://github.com/cordova-rtc/cordova-plugin-iosrtc

My problem is when i install it: npm i cordova-plugin-iosrtc

i get an error when i build on ios:

If anyone managed to install it that would be great to help me out. Thank you.

⚠️ ld: Could not find or use auto-linked framework 'WebRTC'

❌ Undefined symbols for architecture arm64

Symbol: OBJC_CLASS $_RTCMediaConstraints Referenced from: objc-class-ref in PluginRTCPeerConnectionConstraints.o

❌ ld: symbol(s) not found for architecture arm64

If someone has succeeded to install it, it would be great to help me. Thank you.

Finally i found the solution. the iosrtc plugins works with capacitor with this part in your podfile:

def disable_bitcode_for_target(target)
  target.build_configurations.each do |config|
    config.build_settings['ENABLE_BITCODE'] = 'NO'

    remove_cflags_matching(config.build_settings, ['-fembed-bitcode', '-fembed-bitcode-marker'])
  end
end

def remove_cflags_matching(build_settings, cflags)
  existing_cflags = build_settings['OTHER_CFLAGS']

  removed_cflags = []
  if !existing_cflags.nil?
    cflags.each do |cflag|
      existing_cflags.delete_if { |existing_cflag| existing_cflag == cflag && removed_cflags << cflag }
    end
  end

  if removed_cflags.length > 0
    build_settings['OTHER_CFLAGS'] = existing_cflags
  end
end



post_install do |installer|
  project_name = Dir.glob("*.xcodeproj").first
  project = Xcodeproj::Project.open(project_name)
  project.targets.each do |target|
    disable_bitcode_for_target(target)
  end
  project.save

  installer.pods_project.targets.each do |target|
    disable_bitcode_for_target(target)
  end

  installer.pods_project.save
end

If that can help someone:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM