nsarchiving

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

与世无争的帅哥 提交于 2021-02-18 10:10:22
问题 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 it might be something related to a CoreData object or maybe its content Is there a way to catch what's throwing this message or what might cause it? 回答1: apple is removing NSKeyedUnarchiveFromData at some point because it's not secure by default. if

Encoding NSViewController for Lion's user interface resume feature

二次信任 提交于 2019-12-19 01:41:21
问题 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 that the view controller doesn't get unarchived when restoreStateWithCoder: is called. // NSWindowController subclass -(void)encodeRestorableStateWithCoder:(NSCoder *)coder { [super encodeRestorableStateWithCoder:coder]; NSViewController*

Encoding NSViewController for Lion's user interface resume feature

ε祈祈猫儿з 提交于 2019-12-19 01:38:34
问题 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 that the view controller doesn't get unarchived when restoreStateWithCoder: is called. // NSWindowController subclass -(void)encodeRestorableStateWithCoder:(NSCoder *)coder { [super encodeRestorableStateWithCoder:coder]; NSViewController*

How to get file path? Loading documents in Document based app

爷,独闯天下 提交于 2019-12-14 03:09:19
问题 I want to be able to save and load documents, so I'm trying to use these methods: [NSKeyedArchiver archiveRootObject: rootObject toFile: @"myMap.map"]; rootObject = [NSKeyedUnarchiver unarchiveObjectWithFile:@"myMap.map"]; What am I meant to put as the file argument? I just have a constant string for now, but that means I can only load one file, I assume there's a way to get the user's selection from the open panel to be the argument, but how? 回答1: Use NSFileManager: NSArray *allFileNames = [

Using NSCoding on a subclass of custom class

≡放荡痞女 提交于 2019-12-07 02:00:59
问题 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: method as well as encodeWithCoder? Right now, the properties that are specific to the subclass encode/decode fine, but properties the subclass inherit from the superclass do not. Any thoughts? Here is the basic structure: @interface NewsItem :

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

有些话、适合烂在心里 提交于 2019-12-03 10:01:36
问题 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, version 4, system 1000 Is there any documentation on how these files are encoded, or has anyone come up with code that can parse them? Here's an example of such data (also: downloadable): 04 0B 73 74 72 65 61 6D 74 79 70 65 64 81 E8 03 .

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

拜拜、爱过 提交于 2019-12-03 01:39:17
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, version 4, system 1000 Is there any documentation on how these files are encoded, or has anyone come up with code that can parse them? Here's an example of such data (also: downloadable ): 04 0B 73 74 72 65 61 6D 74 79 70 65 64 81 E8 03 ..streamtyped... 84 01 40 84 84 84 12 4E 53 41 74 74 72 69 62 75 ..@....NSAttribu 74 65 64 53 74 72 69 6E 67 00