保存到本地:
NSError *error = NULL; BOOL success = [str writeToFile:document_cache_forum_top atomically:YES encoding:NSUTF8StringEncoding error:&error]; if(!success) { NSLog( @"error saving to %@ - %@", document_cache_forum_top, [error localizedDescription] ); }
读取str:
NSError *error = NULL; NSString *str = [NSString stringWithContentsOfFile:document_cache_forum_top encoding:NSUTF8StringEncoding error:&error];