Saving an image array with UserDefaults

前端 未结 2 1469
北海茫月
北海茫月 2020-12-11 21:00

I have an app where the user takes a picture and once the picture is taken it should be saved to UserDefaults. I keep getting this error:

\"can         


        
2条回答
  •  时光说笑
    2020-12-11 21:22

    Saving blob data in NSUserDefaults will result a huge performance penalty for you app. You have two options:

    1. Save image in cache folder as a file and use NSUserDefaults to store their path
    2. Use CoreData, SQLite or Realm databases to store images. Data structure of your data will determine which one is more appropriate.

提交回复
热议问题