cordova - 如何在离子电容器项目上安装插件 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
如果这可以帮助某人:)
推荐阅读
- c++ - Qt在循环中调用线程
- python - google collabs /keras 不会正确下载数据集
- r - 使用 dplyr 合并数据帧
- react-native - 在导航参数上反应原生使用 useEffect
- java - java.lang.ClassCastException:com.codename1.ui.Label 无法转换为 com.codename1.components.MultiButton
- codeblocks - 使用 CodeBlocks 构建 wxWidgets 程序时出错
- string - 在 nlogn 时间内构建后缀数组
- javascript - React App - 删除动态创建的 TextInput 总是删除数组中的最后一个
- python - 如何在庞大的数据集中修改每一列的每一行?
- ios - 有没有办法为`UIApplication.shared`添加`if(iOSApplicationExtension)`条件