diff --git a/src/imagepicker.ios.ts b/src/imagepicker.ios.ts index e6393fc..15ae887 100644 --- a/src/imagepicker.ios.ts +++ b/src/imagepicker.ios.ts @@ -24,7 +24,11 @@ export class ImagePicker extends data_observable.Observable { // lazy-load latest frame.topmost() if _hostName is not used get hostView() { - return this._hostView || frame.topmost(); + return this._hostView; + } + + get hostController() { + return this.hostView ? this.hostView.viewController : UIApplication.sharedApplication.keyWindow.rootViewController; } constructor(options: Options = {}, hostView: View) { @@ -68,7 +72,7 @@ export class ImagePicker extends data_observable.Observable { this._imagePickerControllerDelegate._resolve = resolve; this._imagePickerControllerDelegate._reject = reject; - (this.hostView).viewController.presentViewControllerAnimatedCompletion(this._imagePickerController, true, null); + this.hostController.presentViewControllerAnimatedCompletion(this._imagePickerController, true, null); }); } } diff --git a/src/package.json b/src/package.json index 1d373ee..b599e74 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-imagepicker", - "version": "6.0.3", + "version": "6.0.4", "description": "A plugin for the NativeScript framework implementing multiple image picker", "repository": { "type": "git", @@ -10,8 +10,8 @@ "typings": "index.d.ts", "nativescript": { "platforms": { - "android": "3.0.0", - "ios": "3.0.0" + "android": "4.0.0", + "ios": "4.0.0" } }, "scripts": { @@ -46,9 +46,9 @@ "homepage": "https://github.com/NativeScript/nativescript-imagepicker", "readmeFilename": "README.md", "devDependencies": { - "tns-core-modules": "^3.1.0", - "tns-platform-declarations": "^3.1.0", - "typescript": "~2.6.0", + "tns-core-modules": "^4.0.0", + "tns-platform-declarations": "^4.0.0", + "typescript": "~2.7.0", "tslint": "~5.4.3" }, "dependencies": {