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

前端 未结 11 1739
闹比i
闹比i 2020-11-22 15:00

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 se         


        
11条回答
  •  暖寄归人
    2020-11-22 15:52

    https://developer.apple.com/reference/foundation/userdefaults

    A default object must be a property list—that is, an instance of (or for collections, a combination of instances of): NSData, NSString, NSNumber, NSDate, NSArray, or NSDictionary.

    If you want to store any other type of object, you should typically archive it to create an instance of NSData. For more details, see Preferences and Settings Programming Guide.

提交回复
热议问题