mostafa-mansour1 / previewAnyFile

Cordova Plugin to preview any file in native mode by providing the local or external URL
MIT License
33 stars 31 forks source link

Unable to run the code on iOS #34

Closed divakarlasrinivas closed 2 years ago

divakarlasrinivas commented 3 years ago

I am unable to run the code in Angular/Cordova for iOS version 14.6 : Below is the stack trace

Error: The old format of this exec call has been removed (deprecated since 2.1). Change to: cordova.exec(null, null, 'Service', 'action', [ arg1, arg2 ]); iOSExec — ios-wkwebview-exec.js:103 execProxy — ios-wkwebview-exec.js:151 (anonymous function) — preview.js:16 (anonymous function) — common.js:48 (anonymous function) — common.js:8 ZoneAwarePromise — zone-evergreen.js:960 tryNativePromise — common.js:7 wrapPromise — common.js:31 previewBase64 — preview-file.service.ts:21 openAsImage — map-info-collection.component.ts:273 openMapInSelectedFormat — map-info-collection.component.ts:215 (anonymous function) — map-info-collection.component.ts:187 generatorResume (anonymous function) — tslib.es6.js:76 ZoneAwarePromise — zone-evergreen.js:960 __awaiter — tslib.es6.js:72 listener — events.js:50 (anonymous function) — Target.js:114:84 (anonymous function) — Composite.js:76 (anonymous function) — PluggableMap.js:902 (anonymous function) — PluggableMap.js:1177 onInvokeTask — core.js:28564 runTask — zone-evergreen.js:167 invokeTask — zone-evergreen.js:480 timer — zone-evergreen.js:2552

mostafa-mansour1 commented 3 years ago

the ionic native wrapper not updated you have two options 1- use the direct plugin

(<any>window).PreviewAnyFile.previewBase64(
        win => console.log("open status",win),
        error => console.error("open failed", error),
        'JVBERi0xLjMKJcTl8uXr.....',{mimeType:'application/pdf'}
    );

2- Manually update the wrapper from the link https://github.com/mostafa-mansour1/previewAnyFile/files/5912855/preview-any-file.zip node_modules/@ionic-native/preview-any-file

mostafa-mansour1 commented 2 years ago

the ionic team merged my change, you can safely use the latest ionic native to make it work