Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 03-15-2010, 01:12 PM   #2 (permalink)
smasher
Senior Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
Default

The method writeToFile: only works if the contents are "property list objects," that is, a combination of NSString, NSData, NSArray, or NSDictionary. It won't work with your custom objects.

If you make your objects conform to NSCoding, however, then you can save an array of them using NSKeyedArchiver instead:

Code:
[NSKeyedArchiver archiveRootObject: array toFile:filePath];
Here's a tutorial on how to make your objects conform to NSCoding.
How to save your game (or any object) on the iPhone | Dead Panic
__________________

Free Games!
smasher is offline   Reply With Quote
 

» Advertisements
» Online Users: 260
18 members and 242 guests
ADY, apatsufas, BdR, ckgni, F_Bryant, jakerocheleau, joeallenpro, ketaskin, MarkC, michelle, Music Man, NSeven, smethorst, Sunny46, themathminister, TheWebWizz, V_SC&, ziocleto
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,876
Threads: 89,225
Posts: 380,710
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jorge599
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:16 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.