【发布时间】:2016-10-11 14:36:27
【问题描述】:
我正在尝试让相机(硬件访问)在 Windows 10 上的 nativescript angular2 应用程序中工作。
但是在命令提示符中构建后我不断收到错误: - tns 运行安卓
这是我的代码:
app.component.ts
import { Component } from "@angular/core";
import cameraModule = require("camera");
import imageModule = require("ui/image");
@Component({
selector: "my-app",
templateUrl: "app.component.html"
})
export class AppComponent {
public takePic() {
cameraModule.takePicture().then(picture => {
console.log("Result is an image source instance");
var image = new imageModule.Image();
image.imageSource = picture;
});
}
}
app.component.html
<StackLayout>
<Label text="Take a picture" class="title"></Label>
<Button text="take" (tap)="takePic()"></Button>
<Label [text]="take" class="message" textWrap="true"></Label>
这是我得到的错误:
EXCEPTION: Uncaught (in promise): Error: android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/org.nativescript.camera/files/cameraPicture_1010201614233.jpg exposed beyond app through ClipData.Item.getUri()
【问题讨论】:
标签: angular camera nativescript