Phonegap ios相机在设备而非模拟器上失败 [英] Phonegap ios Camera fails on device not simulator

查看:91
本文介绍了Phonegap ios相机在设备而非模拟器上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Phonegap为使用设备摄像头的IOS和android制作一个小应用程序,然后使用Phonegap Build上传它.问题在于相机插件似乎无法在设备上运行,尽管它可以在模拟器上运行(打开照相馆,所以我知道它可以运行). 我使用以下代码:

I'm using Phonegap to make a little app for IOS and android that uses the camera of the device and then I upload it with Phonegap Build. The problem is that the camera plugin doesn't seem to work on a device, altho it works on a simulator ( opens up the photolibrary, so I know it works). I use the following code:

navigator.camera.getPicture(uploadPhoto, onFail, { quality: 50, destinationType: Camera.DestinationType.FILE_URI,sourceType:Camera.PictureSourceType.PHOTOLIBRARY});

该设备甚至都没有执行onFail函数,我相信它无法将getPicture识别为功能,因为它确实将navigator.camera识别为对象.

The device doesn't even go to the onFail function, I believe it doesn't recognize getPicture as a function since it does recognize navigator.camera as an object.

我认为问题出在config.xml文件中,因为如果我删除了地理位置插件(可以正常工作),出于某种原因它仍会使用该插件.

I believe the problem lays somewhere in the config.xml file since if I delete the geolocation plugin ( that works ) it still uses that plugin for some reason.

这是我放入xml中的内容:

Here are the things I've put in the xml:

<feature name="http://api.phonegap.com/1.0/camera"/>
<feature name="Camera">
        <param name="ios-package" value="CDVCamera" />
    </feature>
<gap: Camera ...> (forgot the syntax)

这听起来很实用,我可能遗漏了一些重要信息,但是您能提供给我的任何信息将不胜感激.

This might sound vage and I probably left out some important info, but any info you can give me would be greatly appreciated.

推荐答案

虽然晚了,但是我将来可能对其他人有帮助:我怀疑这里的问题是

Years late, but I this may help others in the future: I suspect that the problem here was that Xcode simulator does not support audio and video input as of iOS 8.2, which was shortly before this question was asked.

尽管可以在Simulator中模拟设备的大多数功能,但是必须直接在设备上测试某些硬件功能.从iOS 8.2开始尚未仿真的硬件功能包括:

Though most of the functionality of devices can be simulated in Simulator, some hardware features must be tested directly on a device. The hardware features that are not simulated as of iOS 8.2 are:

不支持运动支持(加速度计和陀螺仪). 不支持音频和视频输入(相机和麦克风).

Motion support (accelerometer and gyroscope) are unsupported. Audio and video input (camera and microphone) are unsupported.

这篇关于Phonegap ios相机在设备而非模拟器上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆