I do a iphone apps and I try to write in a file like this:
data = [NSMutableData dataWithBytes:LogString length:[LogString length]];
file = [NSFileHandle fileHandleForUpdatingAtPath:filePath];
[file seekToEndOfFile];
[file writeData: data];
[file closeFile];
But the problem is that if I try to write the string “awf”, the content of the file is “†∂…‡
You’re not using
LogStringcorrectly. I’m assuming it’s a string, since that’s the logical choice for an object with a-lengthmethod (and that’s not already anNSData).If that’s the case, you should do: