What is the easiest way to programatically create file.txt on your device, then in your application write down some data and then send this data to your Computer?
I guess that the last part could be done programatically same as using some program on your computer to get data from the device.
Till now am doing something like this
NSFileHandle *infile;
NSFileManager *fm;
fm=[NSFileManager defaultManager];
NSString *strings=[@"/Downloads/file.txt" stringByExpandingTildeInPath];
if (![fm fileExistsAtPath:strings]) {
[fm createFileAtPath:strings contents:nil attributes:nil];
infile=[NSFileHandle fileHandleForWritingAtPath:strings];
[infile writeData:[[NSString stringWithFormat:@"lalala japierdole\n", [NSDate date]] dataUsingEncoding:NSUTF8StringEncoding]];
}else {
infile=[NSFileHandle fileHandleForWritingAtPath:strings];
[infile seekToEndOfFile];
}
[infile writeData:[[NSString stringWithFormat:@"lulukukuioio.\n", [NSDate date]] dataUsingEncoding:NSUTF8StringEncoding]];
This is just creating the file if it is not exist and writing down some data but I have a problem with path. This code works fine when I am working with my simulator when am trying this on my device then I really don't know if I even create the file and how to receive from it later.