Я получаю ошибки в этом куске кода; Я разместил сообщения об ошибках в комментариях. Не могу понять.
Заранее спасибо.
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
@autoreleasepool {
NSMutableString *str = [[NSMutableString alloc]init];
for (int i = 0; i < 10; i++) {
[str appendString:@"Aaron is cool!\n"];
}
// Declare a pointer to an NSError object, but don't instantiate it.
// The NSError instance will only be created if there is, in fact, an error.
NSError *error = nil;
// Pass the error pointer by reference to the NSString method
BOOL success =[str writeToFile:@"/tmp/cool.txt"; // Expected "]"
atomically:YES // Bad receiver type 'int'
encoding:NSUTF8StringEncoding
error:&error];
// Test the returned BOOL, and query the NSError if the write failed
if (success) {
NSLog(@"done writing /tmp/cool.txt");
} else {
NSLog(@"writing /tmp/cool/txt failed:@", error localizedDescription); // Expected ')'
}
}
return 0;
}