UserDefaults size error - Team-HGD/SniffMEET GitHub Wiki
๊ณต์ ๋ฌธ์ ์์์๋ tvOS๋ฅผ ์ ์ธํ๊ณ ๋ UserDefaults์ ์ ์ฅํ ์ ์๋ ๋ฐ์ดํฐ size์ limit๋ ์๋ค๊ณ ํ๋ค.
Currently, there is only a size limit for data stored to local user defaults on tvOS, which posts a warning notification when user defaults storage reaches 512kB in size, and terminates apps when user defaults storage reaches 1MB in size.
๊ทธ๋์ ์์ฌํ๊ณ ๋ฐ๋ชจ์ฉ์ผ๋ก ํ๋กํ ์ด๋ฏธ์ง๋ฅผ UserDefaults์ ์ ์ฅํ๊ณ ์์๋๋ฐ
์๋์ ๊ฐ์ ์๋ฌ๊ฐ ๋ฐ์ํ๋ค.
4194304๋ฉด ๋ฑ 4MB์ธ๋ฐ, ์ ์ด๋ฌ๋ ๊ฑธ๊น?
์ฐพ์๋ณด๋ ํฌ๋ผ์์๋ ์ด๋ฏธ ๊ด๋ จ๋ ์ด์์ ๋ํด ์ด์ผ๊ธฐ๋ฅผ ๋๋ ๊ฒ ์์ด์ ์ดํด๋ดค๋ค.
[iOS13ใงๅฏใใซ่ฟฝๅ ใใใUserDefaultsใธใฎไฟๅญๅถ้ - Takahiro Octopress Blog](https://grandbig.github.io/blog/2019/10/19/ios13-userdefaults/)
์ ๊ธ์ ์ดํด๋ณด๋ฉด 4MB๋ฅผ ์ฝ๊ฐ ๋๋ ์์ค์ ์ ์ฅํด์ฃผ๊ณ ์์ ํ ๋ฒ์๋ฅผ ๋์ด๊ฐ ๋ฐ์ดํฐ๋ ์ ์ฅ๋์ง ์๋๋ค๊ณ ํ๋ค.
์๊ฐํ ๊ธ์์๋ ๋ฐ์ดํฐ๊ฐ ์ ์ค๋๋ค๊ณ ๋ ํ๋๋ฐ, ์ค์ ๋ก ์ฐ๋ฆฌ ์๋น์ค์์ ํ ์คํธํ ๋๋ ์ ์ฅ์ ๋๋ค.
์ ์ฅ ์ฌ๋ถ๋ ํ ์คํธ ํ๊ฒฝ๋ง๋ค ๋ค๋ฅธ ๋ถ๋ถ์ด ์๋ ๋ฏ ์ถ๋ค. ์ด ๋ถ๋ถ์ ๋ ์ฐพ์๋ด์ผ๊ฒ ๋ค.
์์ ์ฑ์ ์ํด์ ํฐ ๋ฐ์ดํฐ ์ ์ฅ์ UserDefaults ๋์ CoreData, FileManager๋ฅผ ํ์ฉํ๋ ๊ฒ ์ข๊ฒ ๋ค.
Ref.
[sizeLimitExceededNotification | Apple Developer Documentation](https://developer.apple.com/documentation/foundation/userdefaults/1617187-sizelimitexceedednotification)
[iOS 13 - Attempting to store >=โฆ | Apple Developer Forums](https://developer.apple.com/forums/thread/121527)