Giter Site home page Giter Site logo

Comments (11)

NickIliev avatar NickIliev commented on July 18, 2024 1

@roblav96 yes this is resolved with this commit

from nativescript-background-http.

NickIliev avatar NickIliev commented on July 18, 2024

@terreb

As a workaround for this issue you can do the following

if (app.ios) {
    var fileUri = NSURL.fileURLWithPath(filePath).toString();
}

and then pass it to uploadFile

let task = session.uploadFile(fileUri, options);

Which will normalize your filePath to the one that Apple is expecting.

from nativescript-background-http.

NickIliev avatar NickIliev commented on July 18, 2024

@PanayotCankov

filePath from fs.path.join(path, fileName); is of type

/Users/niliev/Library/Devices/0306F371-E608-42B1-8C1F-D9315835E5C8/Documents/test.png

filUri after NSURL.fileURLWithPath(filePath)

file:///Users/niliev/Library/Devices/0306F371-E608-42B1-8C1F-D9315835E5C8/Documents/test.png

from nativescript-background-http.

terreb avatar terreb commented on July 18, 2024

@NickIliev

Thank you, this works.

from nativescript-background-http.

NickIliev avatar NickIliev commented on July 18, 2024

@terreb

Thanks for reporting this problem - the next release of this plugin (nativescript-background-http) will have this issue fixed.

from nativescript-background-http.

roblav96 avatar roblav96 commented on July 18, 2024

Has this been resolved yet?

from nativescript-background-http.

dlucidone avatar dlucidone commented on July 18, 2024

NSURL gives error ? How to import that var?

from nativescript-background-http.

NickIliev avatar NickIliev commented on July 18, 2024

@dlucidone are you using TypeScript?
If so, you should either install the tns-platform-declarations or declare a type for your NSURL. Using the declarations will provide you with IntelliSense for the native API so it is the recommended way.
However, if you do not need the IntelliSense and you are going to use the only NSURL from the native iOS API then you can simply declare its type as any to prevent TypeScript from throwing type related error.

e.g.

declare var NSURL: any;

if (app.ios) {
    var fileUri = NSURL.fileURLWithPath(filePath).toString();
}

from nativescript-background-http.

dlucidone avatar dlucidone commented on July 18, 2024

@NickIliev thanks for the response but now after this im getting

"/tmp/file:/Users/Dlucidone/Library/Developer/CoreSimulator/Devices/D9C7FD67-A0D7-42F7-98B4-4C8D78CFD0B7/data/Containers/Data/Application/7F2B81A7-5F93-46B3-85C2-6F4E538FDA8C/Documents/BYGCRM1493814304337.png"

from nativescript-background-http.

dlucidone avatar dlucidone commented on July 18, 2024

@NickIliev Any Idea where i'm going wrong

from nativescript-background-http.

dlucidone avatar dlucidone commented on July 18, 2024

the error eim getting is with the name being sent as whole path. I edited in the plugin and made a pull request in the repo

from nativescript-background-http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.