【问题标题】:Phonegap captureImage does nothingPhonegap captureImage 什么都不做
【发布时间】:2013-05-11 14:21:28
【问题描述】:

我已经构建了我的第一个 iOS 应用程序,除了拍照之外一切正常。 下面是我的 Phonegap 配置文件,以及根据我对手册的理解应该让用户拍摄照片的 JavaScript 部分。

当我打电话给navigator.device.capture.captureImage 时,什么也没有发生。

我错过了什么?

<?xml version="1.0" encoding="UTF-8"?> 
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="dk.webcom.longhaul" version="1.0.0">

    <preference name="AllowInlineMediaPlayback" value="false" />
    <preference name="AutoHideSplashScreen" value="true" />
    <preference name="BackupWebStorage" value="cloud" />
    <preference name="DisallowOverscroll" value="false" />
    <preference name="EnableLocation" value="false" /><!-- DEPRECATED -->
    <preference name="EnableViewportScale" value="false" />
    <preference name="FadeSplashScreen" value="true" />
    <preference name="FadeSplashScreenDuration" value=".25" />
    <preference name="HideKeyboardFormAccessoryBar" value="false" />
    <preference name="KeyboardDisplayRequiresUserAction" value="true" />
    <preference name="KeyboardShrinksView" value="false" />
    <preference name="MediaPlaybackRequiresUserAction" value="false" />
    <preference name="ShowSplashScreenSpinner" value="true" />
    <preference name="SuppressesIncrementalRendering" value="false" />
    <preference name="TopActivityIndicator" value="gray" />

    <content src="index.html" />

    <plugins>
        <plugin name="Device" value="CDVDevice" />
        <plugin name="Logger" value="CDVLogger" />
        <!--<plugin name="Compass" value="CDVLocation" />-->
        <!--<plugin name="Accelerometer" value="CDVAccelerometer" />-->
        <plugin name="Camera" value="CDVCamera" />
        <plugin name="NetworkStatus" value="CDVConnection" />
        <!--<plugin name="Contacts" value="CDVContacts" />-->
        <!--<plugin name="Echo" value="CDVEcho" />-->
        <plugin name="File" value="CDVFile" />
        <plugin name="FileTransfer" value="CDVFileTransfer" />
        <plugin name="Geolocation" value="CDVLocation" />
        <plugin name="Notification" value="CDVNotification" />
        <!--<plugin name="Media" value="CDVSound" />-->
        <plugin name="Capture" value="CDVCapture" />
        <!--<plugin name="SplashScreen" value="CDVSplashScreen" />-->
        <!--<plugin name="Battery" value="CDVBattery" />-->
        <!--<plugin name="Globalization" value="CDVGlobalization" />-->
        <!--<plugin name="InAppBrowser" value="CDVInAppBrowser" />-->
    </plugins>

    <access origin="*" />

</widget>

这是应该打开相机的 JavaScript 部分。

        navigator.device.capture.captureImage @photoSuccess, @photoFail,
            limit: 1
        # navigator.camera.getPicture app.photoSuccess, app.photoFail,
        #   quality: 50
        #   destinationType: Camera.DestinationType.FILE_URI

【问题讨论】:

    标签: cordova phonegap-plugins cordova-2.0.0


    【解决方案1】:

    似乎我在 index.html 中缺少 &lt;script src="cordova-2.7.0.js"&gt;&lt;/script&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-03-08
      • 2016-12-24
      • 2017-04-18
      • 2011-08-03
      • 2014-05-11
      • 2014-09-10
      • 1970-01-01
      相关资源
      最近更新 更多