Question

I am developing a guest list(NSMutableArray) and I would like to know If can I create and save this Array in any kind of external file such as .txt .pdf (or another extension)?

Any ideas for do this??

Thanks a lot.

Was it helpful?

Solution

NSArray (which is what NSMutableArray derives from) has a "writeToURL:atomically:" method, which takes a file URL.

Now, if your array contains ONLY objects of the Objective-C types NSString, NSData, NSDate, NSNumber, NSArray or NSDictionary, you should be okay. If you have some custom objects, you'll need to write archiving / unarchiving coder methods which will allow those custom object's data to be written out to a file and read from a file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top