Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

'String' is not convertable to 'StringLiteralConvertable' - Error #10

Closed
petershaw opened this issue Aug 7, 2015 · 1 comment
Closed

Comments

@petershaw
Copy link

Hi,

I am trying to replace a NSURLSession with Just. I am failing with a basic file upload.

Here is my code

        Just.post(
              urlString
            , files: [
                "filename": HTTPFile.URL(url, nil)
            ]
            , auth: (account.username, account.password)
            ) { (r: HTTPResult) in
                print("***** \(r.statusCode)")
                dump(r.text)
        }

But i cet a compile error 'String' is not convertable to 'StringLiteralConvertable' on the "filename" string in line 4.

screen shot 2015-08-08 at 01 15 28

does someone has an idea?

@dduan
Copy link
Owner

dduan commented Aug 12, 2015

Hi @petershaw, experience shows that this kind of error is usually caused by optional values being used where their non-optional counter-parts are expected. Swift is not mature enough to report this accurately.

So, without seeing the rest of your code, I would guess that at least one of url, account.username, account.password is an optional that need unwrapping.

@dduan dduan closed this as completed Aug 25, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants