Nativescript-camera plugin is not working for iOS


#1

Hello,

I am using native script-camera plugin on iPad with iOS version 8.3 but it is throwing this error :

CONSOLE LOG file:///app/tns_modules/@angular/core/./bundles/core.umd.js:3052:20: Angular is running in the development mode. Call enableProdMode() to enable the productio
n mode.
2017-04-11 14:41:26.533 GMP[1302:254163] Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once bef
ore snapshotting or snapshot after screen updates.
2017-04-11 14:41:26.540 GMP[1302:254163] Unable to simultaneously satisfy constraints.
** Probably at least one of the constraints in the following list is one you don’t want. Try this: (1) look at each constraint and try to figure out which you don’t**
expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you’re seeing NSAutoresizingMaskLayoutConstraints that you don’t underst
and, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
** “<NSLayoutConstraint:0x181b8b40 UIView:0x181b9600.height == 0.454545*CAMModeDial:0x181b65c0.height - 4.09091>”,**
** “<NSLayoutConstraint:0x180dcec0 CAMShutterButton:0x181ba550.centerY == CAMBottomBar:0x181b5aa0.centerY>”,**
** “<NSLayoutConstraint:0x180dd1c0 V:[CAMShutterButton:0x181ba550]-(0)-[CAMModeDial:0x181b65c0]>”,**
** “<NSLayoutConstraint:0x180dd1f0 CAMModeDial:0x181b65c0.bottom == UIButton:0x180ca250’Cancel’.top>”,**
** “<NSLayoutConstraint:0x180dd650 V:[UIButton:0x180ca250’Cancel’]-(31)-| (Names: ‘|’:CAMBottomBar:0x181b5aa0 )>”,**
** “<NSLayoutConstraint:0x180dda80 ‘UIView-Encapsulated-Layout-Height’ V:[PLImagePickerCameraView:0x1743d200(0)]>”,**
** “<NSLayoutConstraint:0x180df4b0 CAMBottomBar:0x181b5aa0.height == PLImagePickerCameraView:0x1743d200.height>”**
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x181b8b40 UIView:0x181b9600.height == 0.454545*CAMModeDial:0x181b65c0.height - 4.09091>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2017-04-11 14:41:26.551 GMP[1302:254163] Unable to simultaneously satisfy constraints.
** Probably at least one of the constraints in the following list is one you don’t want. Try this: (1) look at each constraint and try to figure out which you don’t**
expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you’re seeing NSAutoresizingMaskLayoutConstraints that you don’t underst
and, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
** “<NSLayoutConstraint:0x180dcec0 CAMShutterButton:0x181ba550.centerY == CAMBottomBar:0x181b5aa0.centerY>”,**
** “<NSLayoutConstraint:0x180dd1c0 V:[CAMShutterButton:0x181ba550]-(0)-[CAMModeDial:0x181b65c0]>”,**
** “<NSLayoutConstraint:0x180dd1f0 CAMModeDial:0x181b65c0.bottom == UIButton:0x180ca250’Cancel’.top>”,**
** “<NSLayoutConstraint:0x180dd650 V:[UIButton:0x180ca250’Cancel’]-(31)-| (Names: ‘|’:CAMBottomBar:0x181b5aa0 )>”,**
** “<NSLayoutConstraint:0x180dda80 ‘UIView-Encapsulated-Layout-Height’ V:[PLImagePickerCameraView:0x1743d200(0)]>”,**
** “<NSLayoutConstraint:0x180df4b0 CAMBottomBar:0x181b5aa0.height == PLImagePickerCameraView:0x1743d200.height>”**
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x180dd1c0 V:[CAMShutterButton:0x181ba550]-(0)-[CAMModeDial:0x181b65c0]>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

here is my code :

camera.takePicture({}).
    then((imageAsset) => {
        console.log("Result is an image asset instance");
        var image = new Image();
        image.src = imageAsset;
    }).catch((err) => {
        console.log("Error -> " + err.message);
    });

Thanks in advance for help :slight_smile:


#2

I haven’t seen this particular error. Here’s some code that does work, that you can walk through to take pics:

http://www.github.com/jlooper/emoting/mobile


#3

Try this…
import cameraModule = require(“camera”);
import { takePicture } from “nativescript-camera”;
cameraModule.takePicture({ width: 200, height: 200, keepAspectRatio: true ,saveToGallery: true }).then(picture => {
});


#4

Still throwing the same error.


#5

Where are you calling the takePicture method?


#6

this link is missing now, can u share i have issue with camera on ios, that works well on android


#7

hi, I have been using the camera in several apps, try this one: