Saving Swift CLLocation in CoreData

后端 未结 3 790
梦毁少年i
梦毁少年i 2020-12-29 01:11

I am trying to save CLLocation data in Core Data. My property is set as a Transformable object.

Some sample code out there indicates one can save the lo

3条回答
  •  死守一世寂寞
    2020-12-29 01:28

    What you are missing is that NSValue is for storing types, i.e., contiguous blocks of memory, not objects. CLLocation is an object.

    In order to store a CLLocation in core data, you will have to store each of the properties. An alternative is to use a Coder.

提交回复
热议问题