triniwiz / nativescript-downloader

Apache License 2.0
32 stars 18 forks source link

Nativescript 7 migrate!! #54

Closed firumon closed 3 years ago

firumon commented 3 years ago

After migrating to NS7, this plugin throws errors...

triniwiz commented 3 years ago

Exhibit A 😉

ray007 commented 3 years ago

I suspect changing to compilerOptions.target in tsconfig.json to "es6" might already help.

Mc-Mido commented 3 years ago

I suspect changing to compilerOptions.target in tsconfig.json to "es6" might already help.

Yest but then there is a crash after downloading a file when you close the window on iOS.

@triniwiz any news on this plugin migration please ?

sfrcnayds commented 3 years ago

@triniwiz any news on this plugin migration please ?

Mc-Mido commented 3 years ago

@triniwiz any news on this plugin migration please ?

Mc-Mido commented 3 years ago

@firumon @sfrcnayds FYI:

https://github.com/triniwiz/nativescript-plugins/issues/15 https://twitter.com/triniwiz/status/1343501788851425281

Next Youtube (almost ready), Downloader & WebRTC

jeanpaulattard commented 3 years ago

The following error is being thrown TypeError: Class constructor Observable cannot be invoked without 'new' when I call new Downloader(). Is this one of the issues related to migration to NS7? Is there a workaround for it please?

Also what's the status update regarding this plugin please?

sido420 commented 3 years ago

any updates on this? My app upgrade to NS 7 is blocked because of this plugin only. Are there other options?

mdigas commented 3 years ago

Change in file src/tsconfig.json: "target": "es5" to "target": "es6" then use the pack.sh script to rebuild the package. You can download the package from here Install the plugin from file (tns plugin add nativescript-downloader-2.1.5.tgz) and error goes away!

7ammer commented 3 years ago

Hi @mdigas, Unfortunately I'm getting this error after downloading the package and running plugin add nativescript-downloader-2.1.5.tgz.

(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Uncaught Error: -[NSInvocation getArgument:atIndex:]: NULL address argument
7ammer commented 3 years ago

If anyone knows of a solution I'd really appreciate it. It's got to the point where I can no longer provide updates to my app.

mdigas commented 3 years ago

Hi @mdigas, Unfortunately I'm getting this error after downloading the package and running plugin add nativescript-downloader-2.1.5.tgz.

(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Uncaught Error: -[NSInvocation getArgument:atIndex:]: NULL address argument

Hi I think that this error is in background-http: https://github.com/NativeScript/nativescript-background-http/issues/270 and 3rror404 propose a fix in that post: https://github.com/NativeScript/nativescript-background-http/issues/270#issuecomment-699504159

I think that is in ios platform. You can try 3rror404 workaround but you lose the ability to monitor progress with task.upload and task.totalUpload.

ray007 commented 3 years ago

Apparently things are more complicated than just updating the target in tsconfig.json, otherwise I think (hope?) we'd already have gotten a new package.

mdigas commented 3 years ago

Searching the bug, i found that the problem is at downloader.ios.ts line: 291 invocation.getReturnValue(ret);

And for background-http has already fix it with this patch: https://github.com/NativeScript/plugins/pull/16/files/4d28dfa34af72200aade9455bf5dd98505c7c73c

We must follow the above patch for nativescript-downloader

Btw for android platform the above plugin (https://github.com/triniwiz/nativescript-downloader/issues/54#issuecomment-802071979) works ok.

mdigas commented 3 years ago

I followed the guidlines of the above fix for background-http, compiled the nativescript-downloader plugin, test it from here and let me know @7ammer....

Changes in downloader.ios.ts :

remove  line 13  tasksReader = new NativePropertyReader();
 remove lines 270 - end   class NativePropertyReader{}
 change line 87 & 164 from "const state = this.tasksReader.readProp(task, "state", interop.types.int32);" to "const state = task.state;"

Hope its working!

7ammer commented 3 years ago

That's amazing! Thanks @mdigas I'll take a look soon :)

ray007 commented 3 years ago

Should this really be closed without a new release?

triniwiz commented 3 years ago

@triniwiz/nativescript-downloader

ray007 commented 3 years ago

@triniwiz/nativescript-downloader

Thank you. A link to the new source location from this repository would be nice I think...

triniwiz commented 3 years ago

Added to the readme @ray007