ios - 已安装cordova-plugin-camera,但未安装xcode说插件
问题描述
我正在尝试cordova-plugin-camera
开发我的 Ionic 应用程序。我使用cordova plugin add cordova-plugin-camera --save
然后安装它npm i --save @ionic-native/camera
。该包的 node_modules 文件夹已填充,并且该插件存在于我的所有插件文件夹中,我还验证cordova plugin list
了该插件是否显示。我正在使用以下代码尝试启动相机,但它不工作:
import { Component } from "@angular/core";
import { Platform } from "ionic-angular";
import { Camera, CameraOptions } from "@ionic-native/camera";
@Component({
selector: "page-camera",
templateUrl: "camera.html"
})
export class CameraPage {
public base64Image: string;
constructor(public camera: Camera, public platform: Platform) {}
takePicture() {
this.platform.ready().then(() => {
this.camera
.getPicture({
destinationType: this.camera.DestinationType.DATA_URL,
targetWidth: 1000,
targetHeight: 1000
})
.then(
imageData => {
// imageData is a base64 encoded string
this.base64Image = "data:image/jpeg;base64," + imageData;
},
err => {
console.log(err);
}
);
});
}
}
运行此程序并单击调用按钮时,takePicture()
我没有启动相机,也没有控制台错误,但在 safari 内部,我收到以下错误:
2018-12-13 11:31:24.183490-0500 MyApp[3844:312133] ERROR: Plugin 'Camera' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2018-12-13 11:31:24.183546-0500 MyApp[3844:312133] -[CDVCommandQueue executePending] [Line 142] FAILED pluginJSON = ["Camera1764610053","Camera","takePicture",[50,0,1,1000,1000,0,0,false,false,false,null,0]]
解决方案
重置我的分支并重新安装,成功了。我不确定发生了什么,但认为它只是安装不正确。
推荐阅读
- python - PostgreSQL DB 上的 Python SQL 查询托管 ElepantSQL
- database - 从属性添加到所有元素
- r - 为ggplot R创建多线图的数据框
- sql - SSIS 将源 Oledb 数据发送到镶木地板文件中的 S3 存储桶
- google-apps-script - Google Apps 脚本中超过运行时间的复杂转置
- angular - 离子:observable.pipe 不是函数
- c - 找不到“raylib.dll”
- python - 错误:无法为使用 PEP 517 且无法直接安装的摆锤制造轮子
- google-cloud-platform - 如何从 GCP 函数 GUI 调用 PubSub 函数
- mongodb - 从 mongodb 事件计算 DAU/MAU