This is in addition to the @ Wain answer and it is assumed that you are using web browsing to download a text file
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSArray *filePathsArray = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:documentsDirectory error:nil]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF EndsWith '.txt'"]; filePathsArray = [filePathsArray filteredArrayUsingPredicate:predicate]; NSLog(@"files array %@", filePathsArray); NSString *localDocumentsDirectoryVideoFilePath = [documentsDirectory stringByAppendingPathComponent:[filePathsArray objectAtIndex:0]]; NSURL *fileUrl=[NSURL fileURLWithPath: localDocumentsDirectoryVideoFilePath]; [_webview loadRequest:[NSURLRequest requestWithURL:fileUrl]];
Here _webview is an IBOutlet. In addition, this is the loading of the first text file.
Hope this helps.
source share