-3

I want to save photos from photo gallery in my app and after show them in collection View. Is there some way to store this image in array in UserDefaults?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
orper
  • 47
  • 6
  • 1
    Have a look at this question (and the answer..more important :)) : http://stackoverflow.com/questions/29402415/error-when-trying-to-save-image-in-nsuserdefaults-using-swift Hope that helps – pbodsk Mar 29 '17 at 13:50
  • So which way is better? Store pngrepresentation is userdeflauts or use a Core Data? – orper Mar 29 '17 at 15:18

2 Answers2

1

In NSUserDefaults you just must save Dictionary Objects, you must not save big amount of data.

To save big amount of data like images you should take a look to the Sandbox.

Take a look to the tutorial How to save in Sandbox

Aitor Pagán
  • 423
  • 7
  • 18
1

I would use Core Data and/or store them locally.

see the responses in: Saving Picked Image to CoreData

NSUserDefaults should only be used for the applications default values.

Community
  • 1
  • 1
RLoniello
  • 2,309
  • 2
  • 19
  • 26