I knew this question is already asked here. But I am facing some issue which is not getting resolved.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docsPath = [paths objectAtIndex:0];
NSString *fileCacheDirPath = [docsPath stringByAppendingPathComponent:kATTACHMENTS_FOLDER];
NSString *filePath = [fileCacheDirPath stringByAppendingPathComponent:_fileItemDataModel.name];
NSURL *url = [NSURL fileURLWithPath:filePath isDirectory:NO];
Error:
url : file:///Users/Sanoj/Library/Developer/CoreSimulator/Devices/722-6542-4E14-9CC5-24F96EE305D9/data/Containers/Data/Application/B990D3-4311-B580-D2E00E75/Documents/AttachmentsFolder/Scrum_Methodology.pdf
Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSUnderlyingError=0x60800084d950 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=file:///Users/Sanoj/Library/Developer/CoreSimulator/Devices/722CC1FA-6542-4E14-9CC5-24F96EE305D9/data/Containers/Data/Application/B992A9C0-A0D3-4311-B580-D2E0049CFE75/Documents/AttachmentsFolder/Scrum_Methodology.pdf, NSErrorFailingURLKey=file:///Users/Sanoj/Library/Developer/CoreSimulator/Devices/722CC1FA-6542-4E14-9CC5-24F96EE305D9/data/Containers/Data/Application/B992A9C0-A0D3-4311-B580-D2E0049CFE75/Documents/AttachmentsFolder/Scrum_Methodology.pdf, _kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4, NSLocalizedDescription=The request timed out.}}, NSErrorFailingURLStringKey=file:///Users/Sanoj/Library/Developer/CoreSimulator/Devices/722CC1FA-6542-4E14-9CC5-24F96EE305D9/data/Containers/Data/Application/B992A9C0-A0D3-4311-B580-D2E0049CFE75/Documents/AttachmentsFolder/Scrum_Methodology.pdf, NSErrorFailingURLKey=file:///Users/Sanoj/Library/Developer/CoreSimulator/Devices/722CC1FA-6542-4E14-9CC5-24F96EE305D9/data/Containers/Data/Application/B992A9C0-A0D3-4311-B580-D2E0049CFE75/Documents/AttachmentsFolder/Scrum_Methodology.pdf, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.}
NSURL.fileURL
instead of NSURL URLWithString may that help – Prashant Tukadiya