摘要:[iOS] 讀寫檔案範例
[iOS] 讀寫檔案範例
// Document
NSString* documentPath= [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
// Write
NSString* writePaht = [documentPath stringByAppendingPathComponent:@"test.txt"];
NSString* writeContent = @"ABCDEFG";
[writeContent writeToFile:writePaht atomically:NO encoding:NSUTF8StringEncoding error:nil];
// Read
NSString* readPath = [documentPath stringByAppendingPathComponent:@"test.txt"];
NSString* readContent = [NSString stringWithContentsOfFile:readPath encoding:NSUTF8StringEncoding error:nil];
簽名檔
期許自己能以更簡潔的文字與程式碼,傳達出程式設計背後的精神。
真正做到「以形寫神」的境界。