Save a tuple in NSUserDefaults

后端 未结 5 1643
梦毁少年i
梦毁少年i 2021-01-12 13:14

I\'m using a tuple to store something like this.

var accessLavels: (hasInventoryAccess: Bool, hasPayrolAccess: Bool)
accessLavels = (hasInventoryAccess: true         


        
5条回答
  •  深忆病人
    2021-01-12 14:05

    In the documentation, I don't see any method -setValue. Based on the docs, NSUserDefaults is able to save NSString, NSNumber, NSData, NSDictionary, NSArray, NSData and NSDate only. Here is the link: NSUserDefaults Class Reference.

    So, you are not able to save tuple here. And -setValue is from NSKeyValueCodingprotocol.

提交回复
热议问题