Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scalar type in Managed Object only works for IPhone 5

Property 'Latitude' is a scalar type on class 'LatitudeLongitude'. Cannot generate a setter method for it.

When I generated codes for my managed object, I got a message whether I want scalar properties for primitive data type. should I use it? I want to make this application compatible with iPhone 3 - 5

is there any issues with this problem?

like image 420
user4951 Avatar asked Jul 26 '11 05:07

user4951


2 Answers

When you use scalar properties you have to provide implementations of getters and setters for those properties by yourself, as described in documentation:

"You can declare properties as scalar values, but for scalar values Core Data cannot dynamically generate accessor methods—you must provide your own implementations (see “Managed Object Accessor Methods”). Core Data automatically synthesizes the primitive accessor methods (primitiveLength and setPrimitiveLength:), but you need to declare them to suppress compiler warnings."

Documentation

At this place I would recommend you to check this post core-data-scalars.

I hope I have helped.

like image 131
lukewar Avatar answered Oct 22 '22 11:10

lukewar


This is not true, scalars have been supported in Core Data out of the box for a long time. You do not have to implement custom accessors as many blog posts out there indicate.

like image 32
quellish Avatar answered Oct 22 '22 11:10

quellish