AnsweredAssumed Answered

update feature in from text file

Question asked by vikrant327 on Nov 2, 2012
Latest reply on Nov 7, 2012 by vikrant327
Sorry about asking bunch of question in one day. I am new in this development area and having some problems in implementing  few things.
I have three feature layers that I need to update in offline mode. On popupsContainerDidFinishViewingPopups method, I am testing the offline status of the device, and if offline then I am writing feature to a text file. There are saperate textfiles for saperate feature layer. Each text file looks like this, basically writing featureset to file.

"geometryType":"esriGeometryPoint","features":[{"geometry":{"x":456050.74480000045,"y":5001363.0892999982,"spatialReference":{"wkid":26915}},"attributes":{"CostToRepair":"500","USNG":"null","OBJECTID":10003,"Latitude":"null","Notes":"null","Longitude":"null","IndicentID":1,"Structure":2,"Category":1}}],"spatialReference":{"wkid":26915}}


The problem I am having is in updating features back from text file. And the way I am doing is this


 -(IBAction)syncInspections:(id)sender{          NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);                  NSString *documentDir = [paths1 objectAtIndex:0];         NSString *readPolyFile = [documentDir stringByAppendingPathComponent:@"InfraPolygonFile.txt"];         NSString *readLineFile = [documentDir stringByAppendingPathComponent:@"InfraLinesFile.txt"];         NSString *readPointFile = [documentDir stringByAppendingPathComponent:@"InfraPointFile.txt"];                  NSString *addedPolygonString = [NSString stringWithContentsOfFile:readPolyFile              encoding:NSUnicodeStringEncoding error:nil] ;                           NSMutableDictionary *polyDict = [addedPolygonString AGSJSONValue];         NSArray *polyArray = [AGSJSONUtility decodeFromDictionary:polyDict                                                              withKey:@"features"                                                            fromClass:[AGSGraphic class]];          if(polyArray.count){          [self.impactPolygon updateFeatures:polyArray];         }                           NSString *addedPointString = [NSString stringWithContentsOfFile:readPointFile e           ncoding:NSUnicodeStringEncoding error:nil] ;                           NSMutableDictionary *pointDict = [addedPointString AGSJSONValue];         NSArray *pointArray = [AGSJSONUtility decodeFromDictionary:pointDict                                                       withKey:@"features"                                                     fromClass:[AGSGraphic class]];         if(pointArray.count){             [self.impactPoints updateFeatures:pointArray];         }                  NSString *addedLinesString = [NSString stringWithContentsOfFile:readLineFile             encoding:NSUnicodeStringEncoding error:nil] ;                           NSMutableDictionary *linesDict = [addedLinesString AGSJSONValue];         NSArray *linesArray = [AGSJSONUtility decodeFromDictionary:linesDict                                                       withKey:@"features"                                                     fromClass:[AGSGraphic class]];         if(linesArray.count){           [self.impactLine updateFeatures:linesArray];         }          }  - (void)featureLayer:(AGSFeatureLayer *)featureLayer operation:(NSOperation *)op didFailFeatureEditsWithError:(NSError *)error {          NSLog(@"%@,%@",error.localizedDescription, featureLayer.name);      }  


It works fine if I am updating any one layer at a time, that is by commenting out updateFeatures method of other two layer. But, if I am updating all the three layers in this method, then its giving me error message  " 'GET' method not supported" randomly for one of the layer.

Is there anything I am doing wrong.

Any suggestion appreciated.

Outcomes