Troubles with NSString writeToFile

Posted by Jesse on Stack Overflow See other posts from Stack Overflow or by Jesse
Published on 2010-05-24T14:30:39Z Indexed on 2010/05/24 14:31 UTC
Read the original article Hit count: 166

Filed under:
|

Hi everyone,

I have been working on a simple text editor in Cocoa/Objective-C for a practice project and I have come across an error that I would never have expected.

I have an NSString for my file's contents as well as an NSString for it's path. When I attempt to write the contents to a file, I use the following method:

[FileContents writeToFile: CurrentFileName 
               atomically: NO 
                 encoding: NSStringEncoding 
                    error: nil];

I've used this method many times without error yet today, I am getting an error:

"Expected expression before 'NSStringEncoding'"

If anyone can help me out with this it would be greatly appreciated. I can't figure out what could be causing the error. Thanks a lot!

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about nsstring