//追加数据 NSString *homePat = NSHomeDirectory(); NSString *sourcePath = [homePath stringByAppedingPathComponent:@"testfile.ext"]; NSFileHandle *fileHandle = [NSFileHandle fileHandleForUpdatingAtPath:sourcePath]; //将结点跳转到文件末尾 [fileHandle seekToEndOfFile]; NSString *str = @"追加的数据"; NSData *stringData = [str dataUsingEncoding:NSUTF8StringEncoding]; //追加写入的数据 [fileHandle writeData:stringData]; [fileHandle closeFile];