nativescript-imagecropper
nativescript-imagecropper copied to clipboard
Not working on iOS 13.1.2 With Nativescript 6.1.1
Which platform(s) does your issue occur on?
-
iOS
-
iOS versions : 13.1.2
-
I have tested in device
-
CLI: 6.1.2
-
Runtime(s): 6.1.1
node_modules/tns-core-modules/package.json
file in your project) -
Plugin(s): nativescript-imagecropper": "2.0.0"
Please, tell us how to recreate the issue in as much detail as possible.
In ios 13.1.2 when I am capture image from camera then some time image cropper is not working as expected. Sometimes I can able to crop image first time but then not able to crop an image.
I am getting below warning
Warning: Attempt to present <TOCropViewController: 0x110a64a00> on <UIImagePickerController: 0x110194800> whose view is not in the window hierarchy! Servicing an explicit request to stop the session using -[AVCaptureSession stopRunning] regardless of whether it is running or not Immediately enabling application idle timer [CAMCaptureEngine] Got AVCaptureSession did stop running notification: NSConcreteNotification 0x2818bd3b0 {name = AVCaptureSessionDidStopRunningNotification; object = <AVCaptureSession: 0x280c95560 [AVCaptureSessionPresetPhoto]>
have you tried using a setTimeout before calling the cropper?
@shiv19 I have tried it but it is not working. There is also one more issue I found First time image catpure and cropping working but second time image PHOTO button to capture image is not display properly. Half button is hide below the screen in bottom side. This issue occurs after implement cropper.
And Once after successfully cropping image it display below error:
Presenting view controllers on detached view controllers is discouraged <UIViewControllerImpl: 0x10ed76130>. 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. ( "<NSLayoutConstraint:0x282a59f90 UIView:0x130f41150.width == - 16 (active)>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x282a59f90 UIView:0x130f41150.width == - 16 (active)>
facing the same issue, any solution or work around @jitendraashutec @shiv19 @bthurlow
@ParthMaisheri
To fix issue iOS 13 I have changed in image cropper plugin. In cropper plugin if you visit 'src/imagecropper.ios.ts' file
I have replaced below code
let vc = frame.topmost().ios.controller; let page = null; while (vc.presentedViewController && vc.presentedViewController.viewLoaded) { vc = vc.presentedViewController; if (!vc.beingDismissed) page = vc; } if (page === null) throw "No page available for modal";
with
const page = frame.topmost().ios.controller;
and Image cropper is working.
Previously someone has changed this code. don't know what issue he is facing. https://github.com/bthurlow/nativescript-imagecropper/commit/267a2593085f4c7e58b04ae3f56c2371a49e169d
@shiv19 Do you have an idea why he has created PR?
https://github.com/bthurlow/nativescript-imagecropper/issues/49#issuecomment-570948851
Facing same issue in iOS 13 I changed plugin 'src/imagecropper.ios.js' file and
I replaced below code
let vc = frame.topmost().ios.controller; let page = null; while (vc.presentedViewController && vc.presentedViewController.viewLoaded) { vc = vc.presentedViewController; if (!vc.beingDismissed) page = vc; } if (page === null) throw "No page available for modal";
with
const page = topmost().ios.controller;
and include this line at top
const topmost = require("tns-core-modules/ui/frame").topmost;
and Image cropper is working.
@shiv19 can you please give a temp update or merge PR for this changes.
@rjbhatt110 can you check if image cropper can be opened from inside a modal page with your changes? :)