Offline editing

2539
0
11-02-2012 07:25 AM
VIKRANTKRISHNA
New Contributor III
I am trying to implement offline editing of feature layer. In the popupsContainerDidFinishViewPopups menthod, I check for offline status of the device, if offline then I am writing the featureSet to a text file as.

AGSGraphic *graphicToWrite = self.popupVC.currentPopup.graphic;

[self.OfflinePoints addObject:graphicToWrite];

AGSFeatureSet *fSet = [AGSFeatureSet featureSetWithFeatures:self.OfflinePoints];

NSString *str = [NSString stringWithFormat:@"%@", [[fSet encodeToJSON] AGSJSONRepresentation]];

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
             NSString *documentDir = [paths objectAtIndex:0];
             NSString *readFile = [documentDir stringByAppendingPathComponent:@"pointFile.txt"];


BOOL bSuccess = [str1 writeToFile:readFile
                                   atomically:YES
                                     encoding:NSUnicodeStringEncoding
                                        error:nil];
             NSLog(@"Success %@", bSuccess ? @"YES" : @"NO");


The problem here is that there are some values in the attribute which are null. Output written to the textfile looks like this

{"geometryType":"esriGeometryPolyline","features":[{"geometry":{"paths":[[[456694.88599999977,5001929.1936000008],[457409.26250000019,5000738.5662999982],[456456.76059999969,5000579.8160000006]]],"spatialReference":{"wkid":26915}},"attributes":{"CostToRepair":"2000","USNG":"null","OBJECTID":4401,"Latitude":"null","Notes":"null","Longitude":"null","IncidentID":1,"Structure":"null","Category":6}}],"spatialReference":{"wkid":26915}}

All the null values are written as "null".

While updating the featureSet,  I am getting in error log  "GET" method not supported.

I tried this in the REST page and what I noticed was all that String type attributes are fine with "null", but there are some fields which are of type integer or double, and "null" doesn't work for them.

Is there anything I can do to take care of this while writing to text file.
0 Kudos
0 Replies