You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Camera module not working on IOS 10 (only in devices) / It hangs and exit the app #2751
I detected the problem on my app and later verified on the sample-iOS-CameraApp
I submitted a PR with the necessary changes to run (NativeScript/sample-iOS-CameraApp#15) but even that the application hangs at start.
Which platform(s) does your issue occur on?
iOS
Please provide the following version numbers that your issue occurs with:
CLI: 2.3.0
Cross-platform modules: 2.3.0
Runtime(s): 2.3.0
Plugin(s): N/A
Please tell us how to recreate the issue in as much detail as possible.
Just merge the PR and try to run the app on a device (Just confirmed it does not happen on the simulator, I tested on IPhone 6 / IOS 10.0.1).
changed the title [-]Camera module hangs on IOS 10 (only in devices)[/-][+]Camera module not working on IOS 10 (only in devices) / It hangs and exit the app[/+]on Sep 27, 2016
@enchev@dtopuzov guys some expected release date for this ?, is blocking my release, please notice the application crash when activating the camera module, it is not just it doesn't work.
Also I think it will happen in any updated IOS device (only tested in mine but seems to be related to the IOS version).
We are working actively on this and it should be live next week. @ignaciolarranaga, @3rror404 - is this OK for your release dates? Do we need to look for a workaround with the current implementation?
Hi @valentinstoychev, I've moved testing until early next week and set expectations for the missing feature. It would be amazing if there was some sort of workaround available before then but no worries if this isn't possible.
@SpoonIsBad Adding the plist key allows the camera to open but tapping "Use photo" crashes the device. Did you experience this?
I'm actually using a QRCode module, so I don't have a "Use photo" option. I just noticed when I upgraded everything, the app was crashing whenever the QRCode module tried to use the camera, and adding the plist key fixed my problem.
I tried @SpoonIsBad 's suggestion, but no go. For me, my app doesn't crash, but cameraModule.takePicture() does nothing on a device. It does crash on the simulator.
I tried also @SpoonIsBad suggestion, it actually works for me (I take a picture and upload it to my servers without problems) but does not allow me to select pre-existing photos from the phone which I used to do in the past. It might be some change in the underlying API ? (seems it was that right?)
I notice the image is also not resized as per the options given, i.e. the asset returned does not have the expected width/height in DIPs (nor in pixels). I validated this by logging once I get the imageSource (imageSource.width & imageSource.height).
Nativescript-camera plugin resizes images to the screen size of the device. We added this in order to prevent some big bitmaps (it results in a out of memory issue on android). So if you ask for an image size bigger than screen size result image will be with the size of the screen. Indeed you and @cfjedimaster are absolutely right about the missing documentation, but we have some other things to do. We plan to extend this image-asset class to provide methods for saving image to file. So there will be no need to use image-source workaround.
About the non secured variable creationDate - I've made a small fix with version (0.0.4 of nativescript-camera plugin).
Thanks @nsndeck, but I was actually meaning that before the resize was to the width/height specified, not the screen size. For example, I had a code like this:
let width = 1280 / platformModule.screen.mainScreen.scale;
let height = 960 / platformModule.screen.mainScreen.scale;
takePicture({ width: width, height: height, keepAspectRatio: false, saveToGallery: false })
.then(picture => {
let source = new ImageSource();
source.fromAsset(picture)
.then(imageSource => this.coverImage = imageSource);
})
.catch(error => console.log(error));
but it is no longer valid, since the requested width/height are not taken into account. Am I right ?
This is a little confusing because the CameraOptions does have width/height but it should have not if they are going to be ignored.
@ignaciolarranaga actually image-asset uses platformModule.screen.mainScreen.widthDIPS and heightDIPS to resize image. I've just saw a bug in the code of image-asset. I'll fix it and will test your scenario later today.
@nsndeck whenever you can please also check this issue: NativeScript/nativescript-camera#10 something strange happens and the gallery does not open on the device. I noticed it happens even if you just request the permissions (the application hangs)
You maybe already noticed that issue with custom image size has been resolved (completely for iOS and partly for Android). In order to resize the image on Android basically we have to create another bitmap (depending on size this could lead to Out-of-memory exception) therefore we postponed this a little bit to handle that scenario on native side (maybe immediately after the 2.4.0 release we will made necessary additions to tns-core-modules-widgets module).
Activity
[-]Camera module hangs on IOS 10[/-][+]Camera module hangs on IOS 10 (only in devices)[/+]ignaciolarranaga commentedon Sep 21, 2016
Guys some update on this ?
[-]Camera module hangs on IOS 10 (only in devices)[/-][+]Camera module not working on IOS 10 (only in devices) / It hangs and exit the app[/+]ignaciolarranaga commentedon Sep 27, 2016
@enchev @dtopuzov guys some expected release date for this ?, is blocking my release, please notice the application crash when activating the camera module, it is not just it doesn't work.
Also I think it will happen in any updated IOS device (only tested in mine but seems to be related to the IOS version).
Will appreciate any feedback.
3rror404 commentedon Sep 29, 2016
The basic example from the documentation also crashes iOS 10.
This is holding up my release too.
valentinstoychev commentedon Sep 29, 2016
We are working actively on this and it should be live next week. @ignaciolarranaga, @3rror404 - is this OK for your release dates? Do we need to look for a workaround with the current implementation?
SpoonIsBad commentedon Sep 29, 2016
I was having this issue, adding:
to my Info.plist fixed it for me.
3rror404 commentedon Sep 29, 2016
Hi @valentinstoychev, I've moved testing until early next week and set expectations for the missing feature. It would be amazing if there was some sort of workaround available before then but no worries if this isn't possible.
@SpoonIsBad Adding the plist key allows the camera to open but tapping "Use photo" crashes the device. Did you experience this?
SpoonIsBad commentedon Sep 29, 2016
I'm actually using a QRCode module, so I don't have a "Use photo" option. I just noticed when I upgraded everything, the app was crashing whenever the QRCode module tried to use the camera, and adding the plist key fixed my problem.
cfjedimaster commentedon Sep 29, 2016
I tried @SpoonIsBad 's suggestion, but no go. For me, my app doesn't crash, but cameraModule.takePicture() does nothing on a device. It does crash on the simulator.
ignaciolarranaga commentedon Oct 1, 2016
I tried also @SpoonIsBad suggestion, it actually works for me (I take a picture and upload it to my servers without problems) but does not allow me to select pre-existing photos from the phone which I used to do in the past. It might be some change in the underlying API ? (seems it was that right?)
19 remaining items
ignaciolarranaga commentedon Oct 19, 2016
I notice the image is also not resized as per the options given, i.e. the asset returned does not have the expected width/height in DIPs (nor in pixels). I validated this by logging once I get the imageSource (imageSource.width & imageSource.height).
nsndeck commentedon Oct 19, 2016
Hi @ignaciolarranaga,
Nativescript-camera plugin resizes images to the screen size of the device. We added this in order to prevent some big bitmaps (it results in a out of memory issue on android). So if you ask for an image size bigger than screen size result image will be with the size of the screen. Indeed you and @cfjedimaster are absolutely right about the missing documentation, but we have some other things to do. We plan to extend this
image-assetclass to provide methods for saving image to file. So there will be no need to use image-source workaround.About the non secured variable
creationDate- I've made a small fix with version (0.0.4 of nativescript-camera plugin).Nedyalko
ignaciolarranaga commentedon Oct 19, 2016
Thanks @nsndeck, but I was actually meaning that before the resize was to the width/height specified, not the screen size. For example, I had a code like this:
but it is no longer valid, since the requested width/height are not taken into account. Am I right ?
This is a little confusing because the CameraOptions does have width/height but it should have not if they are going to be ignored.
3rror404 commentedon Oct 19, 2016
Custom width and height are definitely not working. I just tested with 300x300 and the image was saved at 2064x1161
ignaciolarranaga commentedon Oct 19, 2016
@nsndeck, here is an example, I changed the code of the CameraTest in this way:
which should produce an square image, but says:
CONSOLE LOG file:///app/main-page.js:25:24: Size: 375x667and here is how it looks:

Just raised an issue for tracking: NativeScript/nativescript-camera#7
nsndeck commentedon Oct 19, 2016
@ignaciolarranaga actually image-asset uses
platformModule.screen.mainScreen.widthDIPSandheightDIPSto resize image. I've just saw a bug in the code ofimage-asset. I'll fix it and will test your scenario later today.ignaciolarranaga commentedon Oct 21, 2016
@nsndeck whenever you can please also check this issue: NativeScript/nativescript-camera#10 something strange happens and the gallery does not open on the device. I noticed it happens even if you just request the permissions (the application hangs)
nsndeck commentedon Oct 24, 2016
Hi @ignaciolarranaga,
You maybe already noticed that issue with custom image size has been resolved (completely for iOS and partly for Android). In order to resize the image on Android basically we have to create another bitmap (depending on size this could lead to Out-of-memory exception) therefore we postponed this a little bit to handle that scenario on native side (maybe immediately after the 2.4.0 release we will made necessary additions to
tns-core-modules-widgetsmodule).Nedyalko
ignaciolarranaga commentedon Oct 24, 2016
Thanks @nsndeck ! Are the changes included in nativescript-camera-0.0.4 ?
lock commentedon Aug 29, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.