我的代码在这里假设有什么问题:
-(void)writetofile:(NSMutableString *)str{
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *path = [paths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/code.txt",path];
NSStringEncoding *encode=NULL;
[str writeToFile:filePath atomically:YES encoding:*encode error:nil];
}