Hi ,
i'm trying to update AGSFeature , adding a feature is working with me but updating the same feature is not working
this the code i'm using For Update :
NSLog(@"%@",CurrentFeatureGraphic);
// Here i'm changing the Feature Attributes Only for the Description , i'm not changing any thing else
NSMutableDictionary *graphicAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithFormat:@"%@",MarkupDescription.text], @"Description",
[NSString stringWithFormat:@"%@",MarkupJobID.text], @"JOB_ID",
[NSString stringWithFormat:@"%@",Delegat.SelectedMarkupOobjecID], @"OBJECTID",
nil];
AGSFeatureLayer *flayer = (AGSFeatureLayer*)FeatureLayer;
CurrentFeatureGraphic.attributes = graphicAttributes;
int oid = [flayer objectIdForFeature:CurrentFeatureGraphic];
if(!flayer.editable){
NSLog(@"Layer does not support editing");
//bail out
}
if (oid > 0)
{
NSOperation *result = [flayer updateFeatures:[NSArray arrayWithObject:CurrentFeatureGraphic]];
NSLog(@"result %@",result);
[flayer dataChanged];
}
this the code i'm using For Adding :
AGSMutablePolygon *Polygon;
for (AGSGraphic *g in graphicsLayer.graphics)
{
if ([g.geometry isKindOfClass:[AGSPolygon class]])
{
Polygon = [[[AGSMutablePolygon alloc] initWithSpatialReference:self.CurrentMap.spatialReference] autorelease];
Polygon = g.geometry;
}
}
NSMutableDictionary *graphicAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithFormat:@"%@",MarkupDescription.text], @"Description",
[NSString stringWithFormat:@"%@",MarkupJobID.text], @"JOB_ID",
nil];
AGSFeatureLayer *flayer = (AGSFeatureLayer*)FeatureLayer;
AGSGraphic *AddFeature = [[AGSGraphic alloc] initWithGeometry:Polygon symbol:nil attributes:graphicAttributes infoTemplateDelegate:self];
NSOperation *result = [flayer addFeatures:[NSArray arrayWithObject:AddFeature]];
[flayer dataChanged];
Thanks ,