mzeeshanid / MZDownloadManager

This download manager uses NSURLSession api to download files. It can download multiple files at a time. It can download large files if app is in background. It can resume downloads if app was quit.
BSD 3-Clause "New" or "Revised" License
1.12k stars 238 forks source link

Invalid URL scheme for background downloads: (null). Valid schemes are http or https #11

Closed gasparenovara closed 9 years ago

gasparenovara commented 9 years ago

When call

if fileURL contain white space in filename so

we have: Invalid URL scheme for background downloads: (null). Valid schemes are http or https

Please replace this line

NSURL *url = [NSURL URLWithString:fileURL];

whith:

NSURL *url = [NSURL URLWithString: [[fileURL stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];

isayeter commented 9 years ago

I think it is not a fault of this library, you can correct the url before sending it to the download task.

mzeeshanid commented 9 years ago

Obviously you can pass the correct the url before sending it to the download manager.

spmPrem commented 8 years ago

Nice its working Fine with NSURL *url = [NSURL URLWithString: [[fileURL stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];