views:

555

answers:

1

What am I doing wrong here:

NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0]; 
self.gpsFilePath = [documentsDirectory stringByAppendingString: @"/gpsReadings.txt"];
self.gpsFile = [NSFileHandle fileHandleForWritingAtPath:self.gpsFilePath];
[self.gpsFile writeData:@"GPS Readings"];
[self.gpsFile closeFile];
+2  A: 

I need to create the file first:

[[NSFileManager defaultManager] createFileAtPath:self.gpsFilePath contents:nil attributes:nil];
Andrew Johnson
If that answers your question, you should mark this as the accepted answer.
titaniumdecoy
If only I could so so within 48 hours of posting, I would. Get back to work :)
Andrew Johnson