Can I use NSUserDefaults with tvOS?

后端 未结 5 2119
囚心锁ツ
囚心锁ツ 2020-12-15 20:57

The App Programming Guide for tvOS briefly states that

There is no persistent local storage for apps on Apple TV. This means that every app d

5条回答
  •  暖寄归人
    2020-12-15 21:24

    NSUserDefaults is available but has a limited size on tvOS. According to Apple staff on forum "NSUserDefaults is allowed, and supports up to 500KB of data." and also "The behaviour is the same as on iOS: NSUserDefaults is persistent as long as the user does not delete the app from the device."

    Also according to NSUserDefaults.h header "NSUserDefaultsSizeLimitExceededNotification is posted on the main queue when more data is stored in user defaults than is allowed. Currently there is no limit for local user defaults except on tvOS, where a warning notification will be posted at 512kB, and the process terminated at 1MB. For ubiquitous defaults, the limit depends on the logged in iCloud user."

提交回复
热议问题