Mani Mani - 1 year ago 206
iOS Question

Convert file path to file url[NSUrl]

I'm try to file upload operation using

multi-part form data. I'm getting following error. I could find out what is error.

[NSURL URLWithString:filePath]

Also used
[[NSURL URLWithString:filePath] filePathURL]
, But doesn't help me.
When I log filepath string: It shows correct path :

@"NSLocalizedFailureReason" : @"Expected URL to be a file URL"

How to convert this path string to
file url

Answer Source

You want to use this method instead:

+ (id)fileURLWithPath:(NSString *)path
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download