Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 2, 2010, 07:44 AM   #1
i.yalovecky
macrumors member
 
Join Date: Feb 2010
NSTreeNode and NSCoder

Can i encode and decode my NSTreeNode tree with NSCoder?
i.yalovecky is offline   0 Reply With Quote
Old Sep 2, 2010, 07:46 AM   #2
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Have you tried?
robbieduncan is offline   0 Reply With Quote
Old Sep 2, 2010, 07:54 AM   #3
i.yalovecky
Thread Starter
macrumors member
 
Join Date: Feb 2010
I don't know how.

The best way for me:
[self.constantsView.rootTreeNode setObjectValue:[aDecoder decodeObject]];
[aCoder encodeObject:[self.constantsView.rootTreeNode objectValue]];

But nothing like objectValue there. I construct tree from plist, i can do reverse and after decoder and encode strings, but still hope for something easier way.
i.yalovecky is offline   0 Reply With Quote
Old Sep 2, 2010, 07:56 AM   #4
i.yalovecky
Thread Starter
macrumors member
 
Join Date: Feb 2010
I read about NSCoder compliant, i need to subclass NSTreeNode or better convert it to source string?
i.yalovecky is offline   0 Reply With Quote
Old Sep 2, 2010, 07:58 AM   #5
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
The simple answer is that NSTreeNode does not confirm to NSCoding (as you could easily have seen by looking at the documentation). As such it cannot be encoded using a NSCoder.
robbieduncan is offline   0 Reply With Quote
Old Sep 2, 2010, 09:22 AM   #6
i.yalovecky
Thread Starter
macrumors member
 
Join Date: Feb 2010
Ok, i convert my tree into plist NSString and encode it and decode it, but how now i can initialize NSDictionary with string? Because initially my tree initialized from plist through dictionary.

Quote:
Originally Posted by i.yalovecky View Post
Ok, i convert my tree into plist NSString and encode it and decode it, but how now i can initialize NSDictionary with string? Because initially my tree initialized from plist through dictionary.
i decide to convert my Tree into Dictionary firstly. So i dont need convertation from string to dictionary.

Last edited by annk; Sep 2, 2010 at 12:08 PM. Reason: Merged two consecutive posts
i.yalovecky is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
iMac and Battlefield 3. Wut? jimbaw iMac 151 Nov 24, 2011 11:51 AM
Erase and Install Problem, Desperate for help! imrealldum iMac 5 Mar 13, 2011 02:02 PM
Photo Delight: color splash, import Facebook photos, share and print. COMING SOON! GlobalDelight iPad Apps 3 Nov 15, 2010 05:47 AM


All times are GMT -5. The time now is 05:02 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC