Questions tagged [nsarchiving]

36 questions
34
votes
6 answers

'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release

I'm receiving a message in the log saying 'bundleNamePlaceholder'[8424:100146] [general] 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release The message is not clear to me but I'm assuming that…
zombie
  • 5,069
  • 3
  • 25
  • 54
10
votes
6 answers

Inspecting files of type "NeXT/Apple typedstream" version 4 (NSArchiver)

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 files as: NeXT/Apple typedstream data, little endian,…
Thomas Tempelmann
  • 11,045
  • 8
  • 74
  • 149
8
votes
2 answers

Encoding NSViewController for Lion's user interface resume feature

Any idea what are the best practices for archiving an NSViewController inside a window for resume (user interface preservation) purposes? I've tried archiving it in the window controller's encodeRestorableStateWithCoder: methods only to find out…
adib
  • 8,285
  • 6
  • 52
  • 91
6
votes
2 answers

Using NSCoding on a subclass of custom class

I am using NSCoding to archive/unarchive a custom class as a method of data persistence. It works fine if the object is a subclass of NSObject, but I also have objects that are subclasses of custom objects. Do I need to change the initWithCoder:…
Jesse Naugher
  • 9,780
  • 1
  • 41
  • 56
4
votes
1 answer

Archiving Custom Object in Swift - Extended

I am working on an iOS App on Swift 4.0. The app uses an 3rd party SDK where there is a model lets say, class Customer: NSCopying, NSObject { var name: String! var age: Int! var address: Address! } At that point I have no control to…
Sazzad Hissain Khan
  • 37,929
  • 33
  • 189
  • 256
4
votes
3 answers

Debuging problems - Values are hidden

I need some ideea about what can be he cause of my problem . I have a source code and i want to make some debug on it , but i can't see the variables. For example : NSArray *oldSavedArray = [NSKeyedUnarchiver…
Adina Marin
  • 663
  • 1
  • 4
  • 15
4
votes
1 answer

How to change the namespace of a Swift class?

When you implement a class MyGreatClass in Swift its fully qualified name will by .MyGreatClass. This is different to Objective-C, where the fully qualified name of that same class is MyGreatClass. Unfortunately this introduces a…
m3o
  • 3,881
  • 3
  • 35
  • 56
2
votes
1 answer

How to update NSKeyedUnarchiver unarchiveObjectWithData to NSKeyedUnarchiver unarchivedObjectOfClass:[fromData:error:

My app currently uses this deprecated function: id unarchivedObject=[NSKeyedUnarchiver unarchiveObjectWithData:codedData]; if([unarchivedObject isKindOfClass:[NSDictionary class]]){ // currently returns TRUE when reading existing user data. }…
wayneh
  • 4,393
  • 9
  • 35
  • 70
2
votes
0 answers

Is it safe to archive Dictionary with String as a key?

According to Apple docs, hash value of string may not be stable across different invocations of app: The hash value is not guaranteed to be stable across different invocations of the same program. Do not persist the hash value across program runs. …
squikend
  • 269
  • 2
  • 7
2
votes
1 answer

NSKeyedArchiver and iCloud

Right now in my application I have a top level object with an -(void)archive method that will archive itself to the application's documents directory. I'm wondering if it's possible to simply save the archive to iCloud rather than locally, by…
cohenadair
  • 2,072
  • 1
  • 22
  • 38
2
votes
0 answers

How to upgrade NSCoding's initWithCoder as properties in a class are changing?

My class has some added properties and I change my class's initWithCoder to parse out the new types. This causes a crash if the archive file is still using the old format. How do I sensibly implement the code without causing such a crash as…
Boon
  • 40,656
  • 60
  • 209
  • 315
2
votes
1 answer

Finding different instances in NSKeyedArchiver

I am currently using this blog where it uses custom classes used with NSKeyedArchiver. Everything seems correct but I am wondering how to get different instances of…
freedom
  • 751
  • 1
  • 10
  • 20
2
votes
1 answer

Map coordinates not decoding

In my app, I am trying to save the pins that are on the map so that they are there when the user opens the app after it is terminated. I have conformed my mkAnnotation class to NSCoding, and implemented the two required methods. The annotations are…
Chandler De Angelis
  • 2,646
  • 6
  • 32
  • 45
2
votes
1 answer

NSKeyedArchiver: distinguishing between different instances of the same class

I'm implementing support for Lion's "Resume" feature in my OS X app. I have a custom subclass of NSViewController in which I implemented the method encodeRestorableStateWithCoder: as: @implementation MyClass (Restoration) …
Yoav
  • 5,962
  • 5
  • 39
  • 61
1
vote
1 answer

Decoding NSArchiver with NSKeyedUnarchiver

I have some old archives that are basically stored preferences created with NSArchiver. I want to be able to decode them with NSKeyedUnarchiver since the NSArchiver/NSUnarchiver are deprecated in favor of their keyed counterparts. Is there any way…
Trygve
  • 1,317
  • 10
  • 27
1
2 3