All Questions

239
votes
7answers
119714 views

How to store custom objects in NSUserDefaults

Alright, so I've been doing some poking around, and I realize my problem, but I don't know how to fix it. I have made a custom class to hold some data. I make objects for this class, and I need to t...
257
votes
14answers
156695 views

iOS: How to store username/password within an app?

I have a login-screen in my iOS app. The username and password will be saved in the NSUserDefaults and be loaded into the login-screen again when you enter the app again (of course, NSUserDefaults are...
203
votes
14answers
146084 views

Save string to the NSUserDefaults?

How to save a string into the NSUserDefaults?
135
votes
7answers
103715 views

Attempt to set a non-property-list object as an NSUserDefaults

I thought I knew what was causing this error, but I can't seem to figure out what I did wrong. Here is the full error message I am getting: Attempt to set a non-property-list object ( "<BC_Pe...
57
votes
7answers
41509 views

Saving custom SWIFT class with NSCoding to UserDefaults

I am currently trying to save a custom Swift class to NSUserDefaults. Here is the code from my Playground: import Foundation class Blog : NSObject, NSCoding { var blogName: String? overrid...
144
votes
6answers
75894 views

Why NSUserDefaults failed to save NSMutableDictionary in iPhone SDK?

I'd like to save an NSMutableDictionary object in NSUserDefaults. The key type in NSMutableDictionary is NSString, the value type is NSArray, which contains a list of object which implements NSCoding....
48
votes
7answers
21793 views

Saving UIColor to and loading from NSUserDefaults

What's the easiest way to save a UIColor into NSUserDefaults and then get it back out?
188
votes
17answers
78932 views

Easy way to see saved NSUserDefaults?

Is there a way to see what's been saved to NSUserDefaults directly? I'd like to see if my data saved correctly.
8
votes
1answers
14730 views

Expected Declaration Error using Swift

I'm trying to pass the boolean value of a UISwitch to another class using NSUserDefaults. For some reason, in the class that contains the switches, the if statements that are supposed to set the value...
-2
votes
2answers
522 views

Using NSUserDefaults on arrays

I am trying to use NSUserDefaults to save an array in to my app's core data. I thought it would be good to use NSUserDefaults but the problem is that wherever I put the code that creates the default i...

Previous Next