nscoding Questions
2
Solved
The FooBar class below has to override the == function of the Equatable type.
However, calling contains on an array of FooBar objects does not cause a breakpoint inside the custom == functio...
4
Solved
I am trying to save object in NSUserDefaults, went throught many questions on this site but could not resolve the issue, my NSObject has an NSMutableArray of another object. like here the main obje...
Reconnaissance asked 4/2, 2013 at 12:19
1
Solved
What would be the code required to allow the storage of an MKPolyline in CoreData in swift.
So for example if I had one of my core data entities (say "myEntity") for which I wanted to save an MKP...
Fifteenth asked 21/4, 2016 at 6:54
1
Solved
Since we have renamed (Bestemming -> Place) the class and rewrote it from Objective-c to Swift some users experience crashes with it. We are trying to load an object from the NSUserDefaults with th...
4
Solved
I've done a lot of NSCoding archiving in Obj-C, but I'm not sure how it handles structs in Swift, nor arrays with optional values. Here is my code:
public struct SquareCoords {
var x: Int, y: Int...
Bravar asked 14/8, 2014 at 14:50
3
Solved
My app saves settings to a file on an iOS device by archiving instances of a class with properties. The class uses the NSCoding protocol, and therefore, I encode these properties using encodeWithCo...
1
Solved
When an instance of my class is initialized using NSCoding, I want to replace it with an existing object in the Core Data database instead of calling:
super.init(entity: ..., insertIntoManagedObje...
2
Solved
I have an object that has a property that might be nil. How should I implement this in encodeWithCoder (and decodeWithCoder)?
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_du...
Hildebrandt asked 18/5, 2014 at 2:25
2
Solved
I have the following class that implements NSCoding and I have created several instances of it and persisted them to file.
@interface BiscuitTin ()
@property NSString *biscuitType;
@property int n...
Dagnah asked 22/4, 2015 at 21:41
1
Solved
I decided to use NSSecureCoding over NSCoding, but I'm having trouble getting it to work.
I would expect the following code to fail, since I'm encoding an NSString but attempting to decode an NSNu...
Acyclic asked 24/3, 2015 at 21:9
6
For a data recovery program I need to be able to extract the values+types from files written by NSArchiver, without having access to Apple's CF / NS frameworks.
The OS X file command reports such ...
Erkan asked 16/9, 2013 at 17:57
3
Solved
I was trying to create a generic encoder and decoder for my model classes. I was trying to find a way to call the "encode method" for all types of properties, either objects (NSString, NSNumber, NS...
Grey asked 28/2, 2012 at 11:29
1
Solved
I'd like to extend a framework class (I don't want to edit the source code directly), and make it conform to NSCoding.
Basically, here's a simplification of the situation I'm in :
/* Can't be edi...
Silurid asked 2/9, 2014 at 20:21
2
I have a 'Thing' object with a String property and an NSImage property; the Thing class has encodeWithCoder: and decodeWithCoder: methods, and I can archive and unarchive a [Thing] array using NSKe...
2
I have a instance variable name in String
var name: String
My class implements the NSCoding protocol. So for name I had
func encodeWithCoder(aCoder: NSCoder) {
aCoder.encodeObject(self.name, f...
1
Solved
I created a Swift class that conforms to NSCoding. (Xcode 6 GM, Swift 1.0)
import Foundation
private var nextNonce = 1000
class Command: NSCoding {
let nonce: Int
let string: String!
init(s...
1
Solved
I have the following code, used to get the path of an object that has been archived
let paths = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask....
Pyrenees asked 2/7, 2014 at 18:46
1
Solved
I'm trying a basic implementation of the NSCoding protocol in swift, but it seems I can't success to unarchive an object after it has been correctly archived.
Here's my attempt
import Cocoa
clas...
Manzano asked 5/7, 2014 at 19:37
4
Solved
My Problem: saveInBackground isn't working.
The Reason It's not working: I'm saving PFObjects stored in an NSArray to file using NSKeyedArchiving. The way I do that is by implementing NSCoding via...
Harrisonharrod asked 16/4, 2014 at 20:43
2
Solved
When saving small amounts of data from within my App is it better to use NSUserDefaults or NSCoding?
Right now I use NSCoding (encodeWithCoder/initWithCoder, etc.) but it appears that NSUserDefault...
Othello asked 11/4, 2014 at 17:19
8
Solved
I have two entities, Chain and Step. Chain has an attribute steps, which may be a multidimensional array of Step entities, for example:
[
step,
step,
step,
[
step,
step
],
step
]
Each St...
Reconvert asked 9/3, 2014 at 15:5
2
Solved
I have a series of nested objects that I am needing to put through the NSCoding protocol so that I can save the top level object into NSUserDefaults.
Here is the structure of objects:
'Instructo...
Cardinal asked 25/9, 2013 at 19:7
3
Solved
I'm learning about the NSSecureCoding protocol introduced by Apple in iOS 6.
From my understanding so far, it should be used whenever a class encodes/decodes instances of itself, in order to preven...
Emirate asked 25/6, 2013 at 15:45
6
Solved
I'd like to save an NSMutableDictionary object in NSUserDefaults. The key type in NSMutableDictionary is NSString, the value type is NSArray, which contains a list of object which implements NSCodi...
Zulmazulu asked 23/1, 2009 at 3:47
1
Solved
i have this enum:
typedef types {
HBIntineraryTypeVisited = 0,
HBIntineraryTypeUnvisited,
HBIntineraryTypeUnknown,
HBIntineraryTypeDeleted,
} HBIntineraryType;
and want to store it along wit...
Intercontinental asked 31/1, 2013 at 9:51
© 2022 - 2024 — McMap. All rights reserved.