Url string return nil iOS swift issue
Solution:
If your filename had space then it returns nil while convert it into URL.So use the addingPercentEncoding to replace the space to %20 then it will works good.
        
If your filename had space then it returns nil while convert it into URL.So use the addingPercentEncoding to replace the space to %20 then it will works good.
        let fileManager = FileManager.default
        let folderPath = loc
        let inputFilePath = documentsDirPath.appendingForm
            var urlString = fileName.addingPercentEncoding
            urlString = "/".appending(urlString!)
            let toURL = URL(string: documentsDirPath.appendingForm
            let fileURL = URL(string: inputFilePath.appendingFormat(
                print(toURL)
                print(fileURL)
Comments
Post a Comment