mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Fixed null pointer while using camera for ios.
This commit is contained in:
@ -60,17 +60,21 @@ class UIImagePickerControllerDelegateImpl extends NSObject implements UIImagePic
|
||||
}
|
||||
}
|
||||
picker.presentingViewController.dismissViewControllerAnimatedCompletion(true, null);
|
||||
listener = null;
|
||||
}
|
||||
|
||||
imagePickerControllerDidCancel(picker): void {
|
||||
picker.presentingViewController.dismissViewControllerAnimatedCompletion(true, null);
|
||||
listener = null;
|
||||
}
|
||||
}
|
||||
|
||||
var listener;
|
||||
|
||||
export var takePicture = function (options?: definition.CameraOptions): Promise<imageSource.ImageSource> {
|
||||
return new Promise<imageSource.ImageSource>((resolve, reject) => {
|
||||
listener = null;
|
||||
var imagePickerController = new UIImagePickerController();
|
||||
var listener = null;
|
||||
var reqWidth = 0;
|
||||
var reqHeight = 0;
|
||||
var keepAspectRatio = true;
|
||||
@ -99,8 +103,7 @@ export var takePicture = function (options?: definition.CameraOptions): Promise<
|
||||
if (topMostFrame) {
|
||||
var viewController: UIViewController = topMostFrame.currentPage && topMostFrame.currentPage.ios;
|
||||
if (viewController) {
|
||||
|
||||
viewController.presentModalViewControllerAnimated(imagePickerController, true);
|
||||
viewController.presentViewControllerAnimatedCompletion(imagePickerController, true, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user