nskeyedarchiver Questions

5

With iOS 12.1, unarchiveObject(withFile:) was deprecated. How can you convert NSKeyedUnarchiver.unarchiveObject(withFile: String) to use a call to NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(...
Unspent asked 1/11, 2018 at 8:3

5

Solved

I have a struct containing a struct and an NSObject that I want to serialize into an NSData object: struct Packet { var name: String var index: Int var numberOfPackets: Int var data: NSData } ...
Carpous asked 7/3, 2015 at 15:34

4

Solved

Please help me! I am stuck in a loop and can't find my way out. I am trying to learn IOS programming for work so I thought I would start with their tutorial app the Meal list application. I am at t...
Leifleifer asked 17/11, 2018 at 1:37

4

Solved

With iOS 12, archiveRootObject:toFile: has been deprecated. Can anyone suggest a streamlined alternative to archiving objects to a file? //Generic example of archiver prior to iOS 12.0 -(BOOL) arc...
Kumiss asked 2/12, 2018 at 12:32

4

I have added category methods to NSUserDefaults to store and retrieve encoded objects (in this case, an NSArray). I am having a problem retrieving the encoded data. Here is my code: - (void)encode...
Methedrine asked 21/9, 2018 at 12:20

3

Solved

I know that there are several questions similar to this, that tend to all revolve around the class not conforming to the protocol properly, but that should not be the immediate issue here. The fol...
Extinctive asked 5/12, 2017 at 17:12

7

Solved

I'm trying to store an Integer and retrieve it using KeyChain. This is how I save it: func SaveNumberOfImagesTaken() { let key = "IMAGE_TAKEN" var taken = 10 let data = NSKeyedArchiver.archiv...
Carbine asked 8/6, 2015 at 21:46

5

Solved

I'm encoding a few complex objects with NSKeyedArchiver and saving it to disk. Say, something like - Class member { int *id; NSString *name; NSMutableArray *array; TempClass *object; } The fun...
Mahayana asked 23/7, 2010 at 18:23

3

Solved

Here is my Codable class: class SensorOutput: Codable { var timeStamp: Date? var gyroX: Double? var gyroY: Double? var gyroZ: Double? var accX: Double? var accY: Double? var accZ: Double...
Binominal asked 21/4, 2018 at 2:11

1

Solved

let lessons = Lessons(definition: "testo", photo: url) SaveUtil.saveLessons(lessons: lessons!) let x = SaveUtil.loadLessons() So everything compiles and runs but x is nil....I'm trying to make...
Dejesus asked 26/9, 2018 at 2:38

3

Im trying to pass an array of 'Employee' objects iPhone to Apple Watch by serializing the array : NSData *encodedObject = [NSKeyedArchiver archivedDataWithRootObject:employees]; and unserializin...

1

Solved

In iOS 12, the NSKeyedArchiver's initializer init(forWritingWith:) was deprecated. Xcode 10 recommends replacing it with the new initializer init(requiringSecureCoding:). The problem is that this i...
Commodus asked 17/7, 2018 at 2:50

1

Solved

The file were created in old project in Objective-C. NSKeyedArchiver* archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:dataForWrite]; [archiver encodeObject:dictVer forKey:@"cityV...
Connor asked 2/3, 2018 at 9:32

1

Solved

My app uses a custom class as its data model: class Drug: NSObject, NSCoding { // Properties, methods etc... } I have just created a Today extension and need to access the user’s data from it, ...
Primateship asked 2/2, 2018 at 13:30

1

Using this to copy UIView UIView copyOfView = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:originalView]] This throws the following error: NSInvalidUn...
Scholl asked 19/3, 2013 at 16:31

4

Solved

I have an array of CLLocation data that I would like to archive. Should the NSUserDefaults system be used? Otherwise, how best to archive the CLLocation data?
Starry asked 10/3, 2011 at 13:2

2

Solved

When try to encode my custom object in iOS swift get this error from Xcode 8.3 unrecognized selector sent to instance 0x60800166fe80 *** -[NSKeyedArchiver dealloc]: warning: NSKeyedArchiver dea...
Unerring asked 17/4, 2017 at 6:6

1

Solved

I'm using NSKeyedArchiver & NSKeyedUnarchiver to store some complex data in Core-Data and retrieve it later in my app. This was working perfectly until now, but after migration, Swift 3.0 does ...
Huddle asked 19/12, 2016 at 14:39

3

Solved

I'm facing unrecognized selector sent to instance error while using NSKeyedArchiver.archivedData. I was trying to store parse the JSON output to the custom class object and store it in NSUserDefau...
Instantaneous asked 5/12, 2016 at 13:31

3

Solved

I have this simple class import UIKit class SimpleModel: NSObject, NSCoding { var name : String! var done : Bool! init(name:String) { self.name = name self.done = false } internal requi...
Pellucid asked 20/8, 2016 at 12:17

2

Solved

Do I need to worry about using archiveRootObject and unarchiveObjectWithFile in background threads? dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ [NSKeyedArchiv...
Illegitimacy asked 13/7, 2015 at 10:55

3

Solved

I'm trying to convert NSData generated from NSKeyedArchiver to an NSString so that I can pass it around and eventually convert it back to NSData. I have to pass this as a string (I'm using three20 ...
Heyman asked 23/5, 2011 at 22:5

2

Solved

I'm trying to program my code so that if the user presses the Night Button the background will turn black and stay black if the user closes the app. (Same goes for day mode.) Please note: I...
Copolymerize asked 19/12, 2015 at 1:3

1

Solved

I have a class which serializes and deserializes with NSCoder/NSKeyedArchiver and NSKeyedUnarchiver. I have unit tests that are designed to check for my handling of various errors inside my seriali...
Steep asked 5/10, 2015 at 9:21

2

Solved

I have an array of objects each with a number of properties. Here is some sample data taken by looping through the array of objects: Name = Rent Default Value 750 This Months Estimate = 750 Sum Of...

© 2022 - 2024 — McMap. All rights reserved.