I tried the below code to load secure feature service layers from our ArcGIS Server hosted in Amazon Web Service and got the error "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 310.)".
NSString *userName = @"TestUser12345";
NSString *password = @"TestUser12345";
AGSCredential *credential = [[AGSCredential alloc]initWithUser: userName password: password];
//NSString *url = @"http://126.96.36.199/arcgis/rest/services/Test/HFDPlanning_Test/FeatureServer";
self.gdbTask = [[AGSGDBSyncTask alloc]initWithURL:[NSURL URLWithString:url] credential:credential];
__weak GenericModule102ViewController *weakSelf = self;
self.gdbTask.loadCompletion = ^(NSError* error)
for (AGSMapServiceLayerInfo* info in weakSelf.gdbTask.featureServiceInfo.layerInfos)
NSURL* url = [weakSelf.gdbTask.URL URLByAppendingPathComponent:[NSString stringWithFormat:@"%lu",(unsigned long)info.layerId]];
AGSFeatureLayer* fl = [AGSFeatureLayer featureServiceLayerWithURL:url mode:AGSFeatureLayerModeOnDemand credential:credential];
fl.outFields = @[@"*"];
fl.delegate = weakSelf;
fl.editingDelegate = weakSelf;
[weakSelf.mapView addMapLayer: fl withName:info.name];
The code worked fine if the feature service was not secured and also worked ok with the same secured feature service on our internal ArcGIS Server (the commented-out url above).
Could anybody shed any light on what I need to do to get it to work?