nscoder Questions
2
I don't think the question mark in public init?(coder aDecoder: NSCoder) is about optionals. Also, when I override it I find I don't need to write the question mark at all.
So what does it mean exa...
2
Solved
Getting error when trying to utilize NSCoder
Player.swift:
class Player: NSObject, NSCoding {
private var _playerName: String!
private var _playerScore: Int!
private var _playerColor: PlayerC...
Canvass asked 5/10, 2016 at 17:39
1
My app currently uses this deprecated function:
id unarchivedObject=[NSKeyedUnarchiver unarchiveObjectWithData:codedData];
if([unarchivedObject isKindOfClass:[NSDictionary class]]){
// currently ...
Strive asked 21/9, 2019 at 18:39
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
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
3
Solved
Background
I am trying to encode a String-style enum using the NSCoding protocol, but I am running into errors converting to and back from String.
I get the following errors while decoding and en...
Upu asked 12/10, 2014 at 15:16
2
Solved
I have CustomTableViewClass in XIB, adding it to UITableView like
class RestaurantsTableView: UITableView {
override func awakeFromNib() {
self.register(UINib(nibName: "RestaurantTableViewCell"...
Calvin asked 27/4, 2017 at 6:59
0
I'm getting these crash reports from XCode (I pasted one at the bottom) and I can't reproduce the error or figure out what the problem is.
From the backtrace I'm thinking it could be related to th...
Thielen asked 30/3, 2017 at 5:12
0
I'm working on using encodeRestorableState/restoreStateWithCoder to save and restore the state of a window. (I'm doing this manually because I want to explicitly save my window state in the documen...
2
So I'm going through this tutorial, and I've finally figured out how to archive an object using NSCoding, and also to initialize it from the filesystem again with the failable initializer.
// To e...
2
Solved
I have tons of objects which I want to save for offline use.
Currently I use create NSCoder compliant classes for the objects and coded data to file to be available offline.
So in the .h I introdu...
Sunwise asked 20/1, 2012 at 7:21
3
Solved
My simple class, ClassWithOneArray, produces this error:
Bitcast requires both operands to be pointer or neither %19 =
bitcast i64 %18 to %objc_object*, !dbg !470 LLVM ERROR: Broken
function f...
1
Solved
NSArchiver is deprecated since OS X 10.2, and is not available AFAIK on iOS
On the other hand, NSKeyedArchiver is known to be lacking on the speed & conciseness part (some users report more th...
Unkindly asked 11/12, 2013 at 15:52
1
Specifically, I'm trying to find the image path. This would be a super useful thing to be able to get, and as far as I've found nobody knows how. I've looked at the generated nib file for keys, and...
Peccavi asked 4/4, 2012 at 17:58
2
Solved
Based on the accepted answer to this question I wrote the following code:
NSData* somedata;
somedata=[NSKeyedArchiver archivedDataWithRootObject:ts];
where ts is an NSAttributedString that is po...
Rictus asked 11/5, 2012 at 21:4
3
Solved
I need to transfer a single object across device. Right now I am converting my NSManagedObject to a dictionary , archiving it and sending as NSData. Upon receiving I am unarchiving it. But I would ...
4
Solved
I've found an unusual crasher with NSCoder when using the Apple LLVM Compiler 3.0 and compiled with -O3. It only crashes on devices. I've tested an iPhone 4 running iOS 5, an iPad 2 running iOS 5 a...
1
Solved
How to decode a long long type property in initWithCoder: and encode in encodeWithCoder: with NSCoder in iOS?
Thanks.
Drippy asked 21/11, 2012 at 4:58
3
Solved
Using the NSObject method -(id)awakeAfterUsingCoder:(NSCoder *)decoder as an example, the documentation says:
Allows an object, after being decoded, to substitute another object
for itself. For...
Phrase asked 22/4, 2012 at 2:46
3
Solved
In my app I am periodically writing a set of dynamic data to file. The data object gets updated about every second. Occasionally I get a "Collection was mutated while being mutated" exception on on...
Basset asked 24/2, 2012 at 1:4
1
Solved
I'm going a bit crazy trying to archive and unarchive a UIImageView which has number of subviews which are custom views derived from UIImageView. Here's what I've done:
Add a category to the proje...
Emlin asked 17/2, 2012 at 19:49
1
Solved
How do you use NSCoder to encode and decode custom types?
For example, how would you use NSCoder with an instance of "STATE" where:
typedef enum { ON, OFF } STATE;
0
I want do something with these step:
Encode a kind of object A with NSKeyedArchiver M and I can get a NSData X.
Init another kind of object B with NSKeyedUnarchiver N from NSData X. The names of ...
Eel asked 24/11, 2010 at 4:41
2
Solved
I have the following method for my class which intends to load a nib file and instantiate the object:
- (id)initWithCoder:(NSCoder*)aDecoder
{
if(self = [super initWithCoder:aDecoder]) {
// Do ...
Soulier asked 15/10, 2010 at 15:41
2
This will load an array
- (id)initWithCoder:(NSCoder*) coder
{
self = [super initWithCoder: coder];
if (self) {
myArray=[coder decodeObjectForKey:@"myArray"];
}
return self;
}
What is the c...
Tristatristam asked 18/9, 2010 at 13:55
1 Next >
© 2022 - 2024 — McMap. All rights reserved.