ios - Getting Value from NSMutableArray -


i developing ios app , working on google map. draw lines on google map , coordinates add on mutablearray , coordinate save on nsuserdefault data save perfectly.but when getting data on nsuserdefault , show coordinate on google maps.but in gmsmutablepath app crash error msg exc_bad_access (code=1,address=0*4).please in advance.

for (int = 0; < [coordinatearray count]; i++) {         nsdictionary *dic = [coordinatearray objectatindex:i];         nsstring *lat = [dic valueforkey:@"lat"];         nsstring *longitude = [dic valueforkey:@"long"];         _valuepoints.latitude = [lat doublevalue];         _valuepoints.longitude = [longitude doublevalue];         gmsmutablepath *path = [[gmsmutablepath alloc]              initwithpath:self.polyline.path];         [path addcoordinate:_valuepoints];         self.polyline.path = path;     } 

save coordinate array directly,

[_arr addobject:coordinate];  nslog(@"%@",_arr); nsuserdefaults *defaults=[nsuserdefaults standarduserdefaults]; 

instead of saving value string, save array itself

[defaults setobject:_arr forkey:@"numberarray"];  [defaults synchronize]; 

when reading data nsuserdefaults,

nsarray *coordinatearray = [ud objectforkey:@"numberarray"]; 

from coordinatearray can loop through objects cllocation objects using latitude , longitude of saved coordinate.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -