ios - Expression is not assignable, coordinate attribute from MKAnnotation class delegate -


i did schema in order explain better troubles.

enter image description here

so, can fix it? thank =)

the cllocationcoordinate2d struct, i.e. value type. passed around value, way of saying "copying". if assign fields (e.g. longitude) modifying copy; original coordinate inside annotation remain intact. why property not assignable.

to fix this, should add separate properties latitude , longitude, , use them instead:

@interface annotation : nsobject<mkannotation>     @property (readwrite) cllocationdegrees latitude;     @property (readwrite) cllocationdegrees longitude;     @property (nonatomic,assign) cllocationcoordinate2d coordinate;     ... @end  @implementation annotation     -(cllocationdegrees) latitude {         return _coordinate.latitude;     }     -(void)setlatitude:(cllocationdegrees)val {         _coordinate.latitude = val;     }     -(cllocationdegrees) longitude{         return _coordinate.longitude;     }     -(void)setlongitude:(cllocationdegrees)val {         _coordinate.longitude = val;     } @end 

now xml parser code can this:

if ([llave isequalto:@"lat"]) {     puntoxml.latitude = [valor doublevalue]; } else if ([llave isequalto:@"lon"]) {     puntoxml.longitude = [valor doublevalue]; } ... 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -