我如何在离子电容器项目上安装插件cordova-plugin-iosrtc

问题描述

我正在尝试使用 getUserMedia 来获取相机的流。 对于我的理解,这是不可能的,因为这个功能还没有在 ios 14.4 中实现或者至少没有被授权。(不允许错误

所以我看到获取流的唯一方法是使用下面的这个cordova插件https://github.com/cordova-rtc/cordova-plugin-iosrtc

我的问题是当我安装它时:npm i cordova-plugin-iosrtc

在 ios 上构建时出现错误

如果有人设法安装它,那对我有很大帮助。 谢谢。

⚠️ ld:找不到或使用自动链接框架“WebRTC”

❌ 架构 arm64 的未定义符号

符号:OBJC_CLASS$_RTcmediaConstraints 引用自:PluginRTCPeerConnectionConstraints.o 中的 objc-class-ref

❌ ld:找不到架构 arm64 的符号

如果有人安装成功了,帮我一下就好了。 谢谢。

解决方法

我终于找到了解决方案。 iosrtc 插件在您的 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

如果这可以帮助某人:)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...