Questions tagged [nscoder]

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.

189 questions
0
votes
1 answer

Trying to archive an instance of a class conforming to NSCoder

I am working on my first Swift iOS app, having trouble serializing and saving an object whose JSON I fetch from the server. I am using Gloss, a lightweight JSON-parsing library which defines a Decodable protocol through which an instance can be…
cproctor
  • 175
  • 8
0
votes
1 answer

Cannot assign Value of type SomeObject to SomeObject?

SO I have two models; Contact and Group, and am archiving/unarchiving their data through NSCoder. Consider this: class Contact { var id: Int = default_value var name: String = "" var number: String = "" init?(Id:Int, Name:String,…
Mohsin Khubaib Ahmed
  • 1,008
  • 16
  • 32
0
votes
2 answers

Swift 2.2: Type '()' does not conform to protocol 'BooleanType'

I have converted an Objective-C method into Swift. And then, into the Swift code i am getting this error. I have no tied what i have done wrong. Objective-C Code - (id)initWithCoder:(NSCoder *)aDecoder { if ((self = [super…
user6248023
0
votes
1 answer

Problems with the NSKeyedArchiver

i've still have got problems with the NSKeyedArchiver. I implemented everything I was told to do, but it still does not work. I'm kind of frustrated. So could anyone help me out? Here is the .h file: #import #import…
Lars Petersen
  • 602
  • 9
  • 21
0
votes
1 answer

Instantiate class with NSCODER

I face a problem when trying to instantiate a class(SettingsView) that uses NSCoder, in another class(Swipe). The SettingsView class is already an instance of an objective -C class(FXBlurView) I get the following error "Missing argument for…
f1rstsurf
  • 637
  • 1
  • 6
  • 22
0
votes
1 answer

Use a class in two different project : decoder exception

I have an exception using this code ; let readingData = NSKeyedUnarchiver.unarchiveObjectWithData(data) as? [ExternalProjectClass] The message in the console : cannot decode object of class (MyIOSApp.ExternalProjectClass) for key (NS.objects); the…
Sébastien REMY
  • 2,399
  • 21
  • 39
0
votes
1 answer

SKSpriteNode setting color in init(NSCoder)

I use XCode 7.2.1 to create a SKSpriteNode in the SceneEditor (with custom class = PlayerNode) I found that Node load from a SKS file are initialized with the method init(coder: NSCoder) so here how i implement PlayerNode class in swift class…
Paul
  • 63
  • 1
  • 6
0
votes
1 answer

Crash when assigning rootViewController in the AppDelegate programmatically

I am not using a storyboard so, I got a problem in the AppDelegate. Look's like very easy but I cannot solve the problem. My Appdelegate.swift file code is the following. window = UIWindow(frame: UIScreen.mainScreen().bounds) window?.backgroundColor…
klaus
  • 51
  • 1
  • 6
0
votes
1 answer

Using NSCore and NSKeyedArchiver with SWIFT

I been trying to get persistent data on my app to have a history of user entries. After I store my data in to array I want to archive it, and after I unarchive it i get weird value instead of what i want to see. Here is my class for where i store…
0
votes
2 answers

Is NSMutableArray writeToFile recursive?

Does NSMutableArray support recursive serialization? E.g. will a NSMutableArray of NSMutableArray's serialize the entirety of the heirarchy out when calling writeToFile? Example: NSMutableArray *topArray = [[NSMutableArray alloc]…
sanderb
  • 43
  • 1
  • 3
  • 6
0
votes
1 answer

Objective C: save array of items (NSCoder)

I am working on challenges from iOS Big Nerd Ranch book of 12th chapter and there is a problem of saving an array of items to the disk. I have BNRDrawView UIView that has an array finishedLines that holds items BNRLine defined by me. I want to use…
Nikita Vlasenko
  • 4,004
  • 7
  • 47
  • 87
0
votes
1 answer

transfer array of custom objects with WatchConnectivity / encoding in Swift

Am trying to transfer an array of custom objects from iOS to watchkitextension. Understood that in order to do so, data needs to be encoded. Am though getting error when decoding. Here we go: The custom object: final class Person: NSObject { …
TPeter
  • 463
  • 3
  • 15
0
votes
1 answer

Having trouble archiving custom object

So I am having this custom made class: LocationSupplementaryObject.h: @interface LocationSupplementaryObject : NSObject @property (nonatomic) NSString*…
0
votes
1 answer

UIControl from xib crashes on ios 7.1

I create a custom UIControl ( MyControl ) in storyboard. on ios 8 and ios 9 everything is fine and there are no crashes in my app. But on ios 7 and, as example, iphone 4, the app crashes when trying to load the view controller which contains this…
mikezs
  • 410
  • 1
  • 8
  • 16
0
votes
2 answers

NSKeyedUnarchiver returns nil after subsequent app launch

EDIT: Have checked and rechecked file paths, code for archiving and unarchiving and no bugs found. Is there an issue with App File System between launches that I am not aware of? I am using NSCoder to store images in my app. I create a unique file…
noobsmcgoobs
  • 2,716
  • 5
  • 32
  • 52