【问题标题】:Ionic Cordova camera issue with ios 10ios 10 的 Ionic Cordova 相机问题
【发布时间】:2017-03-15 10:03:26
【问题描述】:

我正在使用带有 cordova-plugin-camera 2.3.0 的 ionic 1。 我正在使用最新版本的科尔多瓦。

当我在 ios 10 中按下按钮获取图像是否使用相机或画廊 ($cordovaCamera.getPicture) 时,没有任何反应。如果我按下主页按钮并返回应用程序,相机或图库会立即弹出。

我已经启用了它的权限。

这非常适合 ios 9 及更低版本以及所有 android 版本。

请帮忙。

【问题讨论】:

  • 您是否在 info.plist 文件中添加了 NSCameraUsageDescription?
  • 是的,我使用 cordova plugin add cordova-plugin-camera --variable CAMERA_USAGE_DESCRIPTION="我们需要访问您的相机" --save
  • 我大概在这里找到了这个问题的答案:stackoverflow.com/questions/38410159/…

标签: android ios cordova ionic-framework camera


【解决方案1】:

我确认这已在 Cordova app hanging during startup on iOS 10 中解决,正如 Sven Sönnichsen 在对问题的评论中指出的那样。

将gap://ready file: 添加到index.html 中的Content-Security-Policy 元标记。

<meta http-equiv="Content-Security-Policy" content="default-src * gap://ready file:; script-src &apos;self&apos; &apos;unsafe-inline&apos; &apos;unsafe-eval&apos; *; style-src  &apos;self&apos; &apos;unsafe-inline&apos; *">

这里也解决了这个问题:https://forums.adobe.com/thread/2211591 Allsetra ICT 说将元标记更改为这种简单的形式也有效(尽管我没有验证它)。

<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

【讨论】:

  • 抱歉,但是“在 config.xml 中”??那不是在 index.html 中吗?
  • @BraianMellor 谢谢。我编辑了我的答案以反映需要更改的文件是 index.html
  • 我得到的结果是 base64 图像,为此我不得不稍微修改配置。这是相关部分:img-src 'self' data: *; default-src * gap://ready file:;...
猜你喜欢
  • 1970-01-01
  • 2017-01-17
  • 2019-12-29
  • 2018-06-18
  • 2016-02-10
  • 2019-11-18
  • 2021-12-26
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多