Mysterious error on successful camera.getPicture on iPhone / iPad

80 views
Skip to first unread message

Jeff Schwartz

unread,
May 17, 2012, 11:57:02 AM5/17/12
to phonegap
Phonegap-ers,

I've found a very mysterious error when using camera.getPicture in
Cordova 1.7.0 for iOS.
Everything appears to work correctly, except I get a stray JavaScript
error message
and alert box because of a window.onerror handler I added for
debugging purposes.

The error appears to be:
wait_fences: failed to receive reply: 10004003

I also added a window.onerror handler before cordova and I get this
JavaScript Error:
TypeError: 'undefined' is not a function

I believe the wait_fences is the actual error. I've been through the
cordova-1.7.0.js file
pretty thoroughly and can't seem to isolate the error. It is
happening before the 'callbackSuccess'
method.

To reproduce the error:
1) Generate a new cordova 1.7 project.
2) Change the Deployment Target to 4.3
3) Run the project
4) Quit the simulator
4) Modify the www/index.html as follows

5a) Add window.onerror handler
...
<script>window.onerror = function(error) { alert(error); };</script>
<!-- Add this line above cordova -->
<script type="text/javascript" charset="utf-8"
src="cordova-1.7.0.js"></script>

5b) Modify onDeviceReady as below

function onDeviceReady() {
navigator.camera.getPicture(onSuccess, onFail, {});

function onSuccess(imageUri) {
console.log('onSuccess: ' + imageUri);
}

function onFail(message) {
console.log('Failed because: ' + message);
}
}

6) Attach a device with camera and run on device.

7) Take a picture

8) Tap the "Use" button

9) Alert box appears

10) Error happens

11) The log after running the app

2012-05-17 11:42:09.894 TestCamera[178:707] Multi-tasking -> Device:
YES, App: YES
wait_fences: failed to receive reply: 10004003
2012-05-17 11:42:46.088 TestCamera[178:707] [INFO] onSuccess:
file://localhost/var/mobile/Applications/435FBFA2-6382-4DD5-B2A7-97B6FA94DCB1/tmp/photo_004.jpg

I've been through the cordova-1.7.0.js file extensively. I tried
rebooting the device. Nothing seems to work. Note that lowering the
Deployment Target to 3.0 still gives the JavaScript alert error, but
not the wait_fences error.

When running in the Simulator the onFail handler runs as expected.
All of my test iPhones and iPads are on iOS 5 or newer.

Any help would be greatly appreciated.

Thanks in advance.

Sincerely,
Jeff Schwartz
Message has been deleted

Marc Rhodes

unread,
May 18, 2012, 11:45:15 AM5/18/12
to phon...@googlegroups.com
Jeff,

If you search on "wait_fences" you will find more different problems and solutions than you would ever expect. Maybe if you read through a few (or a few dozen :-) ) of those you will find some ideas that relate to the problem you are having. Unfortunately, you may have an extra level of translation since most of the problem descriptions do not have Javascript in the mix.

Marc


Reply all
Reply to author
Forward
0 new messages