1. Loading Data from Files and URLs
// Assuming that there is a text file at /Examples/Test.txt: NSString* filePath = @"/Examples/Test.txt"; NSData* loadedData = [NSData dataWithContentsOfFile:filePath];
2. Load NSData into a string
NSString* loadedString = [[NSString alloc] initWithData:loadedData encoding:NSUTF8StringEncoding];
3. Write NSData into a file
// Here, loadedData is an NSData object NSString* filePath = @"/Examples/Test.txt"; [loadedData writeToFile:filePath atomically:YES];