Re: Extension to class for NSCoding protocol conformance

2014-10-25 Thread Kyle Sluder
On Sat, Oct 25, 2014, at 10:15 AM, Jaikanth CK wrote: > Hi All, > > I need to extend a class for NSCoding protocol conformance. You can't do this yet. Required initializers must be implemented in the main class body, and NSCoding has a required init(coder:) initializer.

Extension to class for NSCoding protocol conformance

2014-10-25 Thread Jaikanth CK
Hi All, I need to extend a class for NSCoding protocol conformance. I tried the following code in the playground and get an error - required initialiser cannot be declared in the extension. If I do not make it required, I get an error asking to make it required ...and so on class first

Re: registerDefaults error and NSCoding protocol

2008-11-27 Thread Bill Bumgarner
From the documentation: ... A default’s value must be a property list, that is, an instance of (or for collections a combination of instances of): NSData,NSString, NSNumber, NSDate, NSArray, or NSDictionary. If you want to store any other type of object, you should typically archive it to c

registerDefaults error and NSCoding protocol

2008-11-27 Thread John Clayton
Hi, Question about registering defaults - I'd assumed the following would be valid, assuming that GuideSettings implements the NSCoding protocol - but my app doesn't like this and throws a bad access exception in CFRetain when I run this code: The bit that falls o

Re: NSCoding protocol

2008-10-11 Thread Michael Ash
On Fri, Oct 10, 2008 at 12:52 PM, Negm-Awad Amin <[EMAIL PROTECTED]> wrote: > Yup, you are complelty right. The correct code: > > if( [BaseClass [EMAIL PROTECTED]( initIWithCoder: )] ) { > … If you want to get really fun, you can check it thus: if([super.class instancesRespondToSelector:...]) Th

Re: NSCoding protocol

2008-10-10 Thread Negm-Awad Amin
Am Fr,10.10.2008 um 18:17 schrieb Clark Cox: On Fri, Oct 10, 2008 at 9:09 AM, Negm-Awad Amin <[EMAIL PROTECTED] > wrote: Am Fr,03.10.2008 um 21:00 schrieb [EMAIL PROTECTED]: I want MyClass to conform to the NSCoding protocol. But I'm puzzled about how to implement the in

Re: NSCoding protocol

2008-10-10 Thread Clark Cox
On Fri, Oct 10, 2008 at 9:09 AM, Negm-Awad Amin <[EMAIL PROTECTED]> wrote: > > Am Fr,03.10.2008 um 21:00 schrieb [EMAIL PROTECTED]: > >> I want MyClass to conform to the NSCoding protocol. But I'm puzzled about >> how to implement the initWithCoder: method. >&g

Re: NSCoding protocol

2008-10-10 Thread Negm-Awad Amin
Am Fr,03.10.2008 um 21:00 schrieb [EMAIL PROTECTED]: I want MyClass to conform to the NSCoding protocol. But I'm puzzled about how to implement the initWithCoder: method. Suppose I have this in MyClass.h: NSString *S1, *S2, *S3; and this in its init function: S1

Re: NSCoding protocol

2008-10-04 Thread Graham Cox
On 4 Oct 2008, at 9:29 am, [EMAIL PROTECTED] wrote: But now I'm confused about how to de-allocate MyClass. Given this in its initialisation: S1 = @"a string"; S2 = [[NSString alloc] init]; S3 = [NSString string]; I would only release S2 in the dealloc method. But if

Re: NSCoding protocol

2008-10-03 Thread Shawn Erickson
On Fri, Oct 3, 2008 at 4:29 PM, <[EMAIL PROTECTED]> wrote: > But now I'm confused about how to de-allocate MyClass. Given this in its > initialisation: > >S1 = @"a string"; >S2 = [[NSString alloc] init]; >S3 = [NSString string]; The line for S3 is wrong since you presumab

Re: NSCoding protocol

2008-10-03 Thread hatzicware
Thanks for your replies. But now I'm confused about how to de-allocate MyClass. Given this in its initialisation: S1 = @"a string"; S2 = [[NSString alloc] init]; S3 = [NSString string]; I would only release S2 in the dealloc method. But if the class has been unarchi

Re: NSCoding protocol

2008-10-03 Thread Nick Zitzmann
On Oct 3, 2008, at 1:00 PM, [EMAIL PROTECTED] wrote: So finally, my question: am I right to retain S2 and S3, and not S1? No. -decodeObject: and -decodeObjectForKey: always return autoreleased objects, so if you use them later, then you must retain them unless the code requires GC. Nic

Re: NSCoding protocol

2008-10-03 Thread Stephen J. Butler
Assuming this is not under GC... On Fri, Oct 3, 2008 at 2:00 PM, <[EMAIL PROTECTED]> wrote: > I want MyClass to conform to the NSCoding protocol. But I'm puzzled about > how to implement the initWithCoder: method. > > Suppose I have this in MyClass.h: > >NSSt

NSCoding protocol

2008-10-03 Thread hatzicware
I want MyClass to conform to the NSCoding protocol. But I'm puzzled about how to implement the initWithCoder: method. Suppose I have this in MyClass.h: NSString *S1, *S2, *S3; and this in its init function: S1 = @"a string"; S2 = [[NSString alloc] in