I want to store a binary file in my IPad-Documents-Directory.
- (void) connectionDidFinishLoading:(NSURLConnection *) connection
NSString *txt = [[[NSString alloc] initWithData:responseData encoding: ?????] autorelease];
//write to disk
file = ...;
[txt writeToFile:file atomically:NO encoding:??? error:NULL];
So, now I get a binary file, that is different from the original one. I assume, it is the encoding or Bigendian / LittleEndian;
If I use an Ascii-File this method works without any problem.
What should I do? Not using NSString? What encoding? Tried severals. None worked.
Any Idea?
You can (and should) save NSData object directly to the disc without converting it to NSString: