Home › Forums › General Discussion › In Monster Checker how to save state??
| Author | Posts |
|---|---|
| Author | Posts |
| February 3, 2012 at 4:58 pm #2263 | |
| Banchain | I have buy your book and I want to know something about save state in Monster Checker. If I want to save state after I terminate the Monster Checker App.When I re-open the game, how could the state will exist in the latest position,not at the starting point. Of course, the piece is kept in the NSMutableArray so the question that I ask may be ,in other words, How to save a NSMutalbeArray that contain a class. Thanks by the way |
| February 7, 2012 at 10:58 pm #2266 | |
| Nat Weiss | Check out the Quexlor project and how it saves state with its Settings object. To store an array, you just use NSCoder’s `encodeObject` and `decodeObjectForKey`. |
| February 8, 2012 at 7:58 am #2267 | |
| Banchain | I can’t do it. If I save an integer,float,bool etc. it is OK but when I save an arrayObject it have an error like this //////////////////////////////// ##################################### //////////////////////////////////// 2012-02-08 14:46:00.897 A – Math[602:10a03] -[zeros encodeWithCoder:]: unrecognized selector sent to instance 0xf75cfc0 //////////////////////////////// ##################################### //////////////////////////////////// while my class name zeros (If I did not save to save path (Save to file) it will ok to save in other word if savePath = nill; –> it can save ) |
| February 11, 2012 at 7:51 pm #2271 | |
| Nat Weiss | You don’t want to do: [zeros encodeWithCoder:] You want to do this: -(void) encodeWithCoder:(NSCoder*)coder // encode an integer // … |
You must be logged in to reply to this topic.