The NSCoder abstract class declares the interface used by concrete subclasses to transfer objects and other Objective-C/Swift data items between memory and some other format.
Questions tagged [nscoder]
189 questions
0
votes
1 answer
Trying to use NSCoder crashes the app on start-up
I have some details stored inside an NSDictionary. I'm using a Master-Detail view on iPad and after I added the initWithCoder method, my app crashes on start-up and I don't know how to make it work.
The reason I want to use NSCoder is to store my…

Sorin Cioban
- 2,237
- 6
- 30
- 36
0
votes
2 answers
Encoding NSAttributedString Throws Error
Based on the accepted answer to this question I wrote the following code:
NSData* somedata;
somedata=[NSKeyedArchiver archivedDataWithRootObject:ts];
where ts is an NSAttributedString that is populated with some text and some attributes (colors, in…

Chris
- 1,013
- 1
- 15
- 35
-1
votes
1 answer
Implementing Hashable and NSCoding in the same class in Swift
I am having an issue trying to adopt the Hashable and NSCoding protocols within the same Swift class (or struct). Hashability and encode/decode both work independently. However, hashability is lost once an object has been restored by…

ksgg
- 31
- 3
-1
votes
2 answers
How can you encode and decode Class type object in objective C?
I have this Object:
@interface EasySortDevices : NSObject
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *iconName;
@property (nonatomic) Class deviceObject;
@end
How can I encode and decode the Class…

Goga Eusebiu
- 29
- 1
- 5
-1
votes
1 answer
NSCoder "only defined abstract class" woes
I have a simple class that (once fleshed out) will constitute the data handled by an NSDocument subclass. But, I am getting stuck right out of the gate trying to save/init the class using NSDocument's data(ofType:) and read(from: ofType:)…

MikeMayer67
- 570
- 6
- 17
-1
votes
1 answer
NSCoder, NSObject vs UIView
When we implement (id)initWithCoder:(NSCoder *)decoder method in NSObject class, we need to call [super **init**], but in UIView somehow we need to call [super **initWithCoder:decoder**]. Why is there such a difference?
The question is not a…

Nikita Vlasenko
- 4,004
- 7
- 47
- 87
-1
votes
1 answer
How to delete save data from a iOS application
I'm developing an IOS App, and I'm currently working on archiving the data with NSCoder, but I had initially saved the wrong data type to a variable, and now its causing my application to crash, I have fixed the problem that was saving the wrong…

austinphilp
- 57
- 1
- 9
-1
votes
1 answer
NSCoder not working with NSArray
I am trying to implement the NSCoder methods encodeWithCoder and initWithCoder for a custom object i have created which has a child array of custom objects. Both custom objects employment the above mentioned methods but after the top level object…

Jarmez De La Rocha
- 618
- 2
- 9
- 19
-2
votes
1 answer
NScoder objective-c run time
NSCoder *coder;
coder=[[NSCoder alloc]init];
[coder encodeObject:@"value" forKey:@"frame"];
Error
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -encodeObject:forKey: cannot be sent to an abstract object of…

Manzoor Husain
- 53
- 5