mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Merge pull request #88 from NativeScript/nnikolov/CameraIssuesIos
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);
|
picker.presentingViewController.dismissViewControllerAnimatedCompletion(true, null);
|
||||||
|
listener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
imagePickerControllerDidCancel(picker): void {
|
imagePickerControllerDidCancel(picker): void {
|
||||||
picker.presentingViewController.dismissViewControllerAnimatedCompletion(true, null);
|
picker.presentingViewController.dismissViewControllerAnimatedCompletion(true, null);
|
||||||
|
listener = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var listener;
|
||||||
|
|
||||||
export var takePicture = function (options?: definition.CameraOptions): Promise<imageSource.ImageSource> {
|
export var takePicture = function (options?: definition.CameraOptions): Promise<imageSource.ImageSource> {
|
||||||
return new Promise<imageSource.ImageSource>((resolve, reject) => {
|
return new Promise<imageSource.ImageSource>((resolve, reject) => {
|
||||||
|
listener = null;
|
||||||
var imagePickerController = new UIImagePickerController();
|
var imagePickerController = new UIImagePickerController();
|
||||||
var listener = null;
|
|
||||||
var reqWidth = 0;
|
var reqWidth = 0;
|
||||||
var reqHeight = 0;
|
var reqHeight = 0;
|
||||||
var keepAspectRatio = true;
|
var keepAspectRatio = true;
|
||||||
@ -99,8 +103,7 @@ export var takePicture = function (options?: definition.CameraOptions): Promise<
|
|||||||
if (topMostFrame) {
|
if (topMostFrame) {
|
||||||
var viewController: UIViewController = topMostFrame.currentPage && topMostFrame.currentPage.ios;
|
var viewController: UIViewController = topMostFrame.currentPage && topMostFrame.currentPage.ios;
|
||||||
if (viewController) {
|
if (viewController) {
|
||||||
|
viewController.presentViewControllerAnimatedCompletion(imagePickerController, true, null);
|
||||||
viewController.presentModalViewControllerAnimated(imagePickerController, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user