You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a very simple model, it's a few booleans, Strings, and so on.
import AutoCoding
public class Bitlink : NSObject {
var longURLString = ""
var shortURLString = ""
var archived = false
var title: String? = ""
... and so on
}
I'm using YapDatabase, which is leveraging NSCoder for persistence. When I save and read from the database, what I saved is correct going in and reading back out. Then when I restart the app, and query, it comes back with the default values.
I tried manually using initWithCoder: and encodeWithCoder:, and that resolved the issues, so I'm fairly certain this has something to do with AutoCoding.
Any thoughts?
The text was updated successfully, but these errors were encountered:
In ViewController.swift, I uncommented out the code in viewDidLoad to save a Dog.
Then I close the app, and comment it out, so no dogs are saved. Then I run the app, enumerating through all the saved Dogs, and it will show 1 Dog, with the default properties that Dog's are initialized with.
I then delete the app, so I don't get an encoding conflict, and in Dog.swift I switch to manual encoding.
I repeat the process, save a Dog by uncommenting the code, close the app, comment out the code that saves dogs, enumerate through the dogs, and this time it pulls up the correct Dog object, not one initialized with the default properties.
Please let me know if that's unclear, and if I can help in any way.
I have a very simple model, it's a few booleans, Strings, and so on.
I'm using YapDatabase, which is leveraging NSCoder for persistence. When I save and read from the database, what I saved is correct going in and reading back out. Then when I restart the app, and query, it comes back with the default values.
I tried manually using
initWithCoder:
andencodeWithCoder:
, and that resolved the issues, so I'm fairly certain this has something to do with AutoCoding.Any thoughts?
The text was updated successfully, but these errors were encountered: