Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS 14 - Image file size 0. #674

Closed
3 tasks done
bojanbizjak opened this issue Oct 9, 2020 · 12 comments · Fixed by #685
Closed
3 tasks done

IOS 14 - Image file size 0. #674

bojanbizjak opened this issue Oct 9, 2020 · 12 comments · Fixed by #685

Comments

@bojanbizjak
Copy link

Bug Report

Problem

What is expected to happen?

After calling navigator.camera.getPicture iOS requires permission for camera and geolocation. After taking and using the photo, the plugin should return the image path with the correct image file.

What does actually happen?

After calling navigator.camera.getPicture iOS requires permission for camera and geolocation. After taking and using the photo, an empty file is created, in my case file: ///var/mobile/Containers/Data/Application/DBF0DD91-F8CD-45BE-963E-6B5F90A8F1CB/tmp/cdv_photo_1602269141.jpg. I have listed the errors that occur in the information section.

Information

2020-10-09 20:45:30.039295+0200 GisMatrix[2261:898438] [Camera] Failed to read exposureBiasesByMode dictionary: Error Domain=NSCocoaErrorDomain Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: data is NULL" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: data is NULL}
2020-10-09 20:45:41.142260+0200 GisMatrix[2261:898438] [GisMatrix] getCFDataBytesAtOffset:1211: : *** ERROR *** CGImageSource was created with data size: 490184 - current size is only: 0
2020-10-09 20:45:41.142354+0200 GisMatrix[2261:898438] [GisMatrix] getCFDataBytesAtOffset:1219: : *** ERROR *** requested range: 0-4096 - is outside input CFData range (0-0)
2020-10-09 20:45:41.144811+0200 GisMatrix[2261:898438] [GisMatrix] addImageFromSource:2548: image 0 of source is nil
2020-10-09 20:45:41.145032+0200 GisMatrix[2261:898438] [GisMatrix] finalizeDestination:3019: image destination must have at least one image

Command or Code

        navigator.camera.getPicture((imageURI: string) => {
            console.log(imageURI);
            // file:///var/mobile/Containers/Data/Application/DBF0DD91-F8CD-45BE-963E-6B5F90A8F1CB/tmp/cdv_photo_1602269141.jpg
        }, {
            quality: 100, 
            destinationType: Camera.DestinationType.FILE_URI,
            sourceType: Camera.PictureSourceType.CAMERA,
            correctOrientation: true,
            saveToPhotoAlbum: false,
            encodingType: Camera.EncodingType.JPEG
        });

The same error also occurs with a combination of parameters: quality: 100 and correctOrientation: false or quality: 50 and correctOrientation: false / true.

Environment, Platform, Device

iPhone 7 Plus
iOS 14.0.1
Xcode: 12.0.1

Version information

    "cordova-ios": "6.1.1",
    "cordova-plugin-add-swift-support": "^2.0.2",
    "cordova-plugin-androidx-adapter": "^1.1.1",
    "cordova-plugin-camera": "^5.0.0",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-device": "^2.0.3",
    "cordova-plugin-dialogs": "^2.0.2",
    "cordova-plugin-file": "^6.0.2",
    "cordova-plugin-media-capture": "^3.0.3",
    "cordova-plugin-network-information": "^2.0.2",
    "cordova-plugin-screen-orientation": "^3.0.2",
    "cordova-plugin-statusbar": "^2.4.3",
    "cordova-plugin-video-editor": "^1.1.3",
    "cordova-plugin-whitelist": "^1.3.4",
    "cordova-plugin-x-socialsharing": "^6.0.2",
    "cordova-sqlite-storage": "^5.0.1",
    "cordova.plugins.diagnostic": "^6.0.2",
    "es6-promise-plugin": "^4.2.2"

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@adam198824
Copy link

I have same issue

@sc0ttdav3y
Copy link

Same here. I have pretty much same plugin configuration as @bojanbizjak.

iPhone 11 Pro
iOS 14.0.1
XCode 12.0.1
Camera Plugin 5.0.0
Cordova iOS 6.1.1

@keo9ren
Copy link

keo9ren commented Oct 13, 2020

Same Issue here. Happens only with permission fir geolocation turned on.

@manindra86
Copy link

I am also facing the same issue. I am using
iPhone XR
iOS. 14.0
Xcode 12.0
Camera plugin 4.1.0
Cordova iOS 5.1.1

@ashokcode
Copy link

ashokcode commented Oct 13, 2020

I am also facing the same issue. I am using
iPhone 11 Pro
iOS 14.0
XCode 12.0
Camera Plugin 4.1.0
Cordova iOS 5.1.1

@timbru31
Copy link
Member

Is anyone able to test the new 14.1 beta builds? This could be an iOS bug, too.

@jcesarmobile
Copy link
Member

Can any of you provide a sample app where it can be reproduced?
That’s more helpful than “me too” messages

@manindra86
Copy link

Can any of you provide a sample app where it can be reproduced?
That’s more helpful than “me too” messages

Hi @jcesarmobile ,
I have attached the sample code . To replicate the issue take multiple picture continuously (~60-70 images). Generally App got crash after 30-40 images. I have also attached the crash log, binary images and Xcode log

Camera-Plugin-Demo.zip

@jcesarmobile
Copy link
Member

That's not the issue discussed here, that has always happened, the native component doesn't release the memory properly and crash the app if you take a lot of pictures.

The issue reported here is iOS 14 specific and says that the size of the image is 0, not that the app crash.

@R4yYx
Copy link

R4yYx commented Oct 21, 2020

@jcesarmobile Here is a sample app, if you take out line 52 in config.xml, for the geolocation preference it works, if you keep it in it doesn't.

https://github.com/R4yYx/IOSSampleAPP

@BanxOnline
Copy link

BanxOnline commented Oct 26, 2020

I had the same problem when I used GetLocation.

config.xml
<preference name="CameraUsesGeolocation" value="true" />

Use this Fork version, the problem is no longer there. This has not been merged.
#492 (comment)

@R4yYx
Copy link

R4yYx commented Oct 28, 2020

fix works, thanks @jcesarmobile!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants