AnsweredAssumed Answered

Trouble loading secure layers in AWS ArcGIS Server

Question asked by ShiminCai on Aug 23, 2016
Latest reply on Aug 23, 2016 by ShiminCai

Hi All,

 

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://awsgis.fcnsw.com.au/arcgis/rest/services/Test/HFDPlanning_Test/FeatureServer";

     //NSString *url = @"http://203.8.108.10/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)

     {

         if(error)

         {

             NSLog(@"%@", error.localizedDescription);

         }

    

         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?

 

Thanks,

 

Shimin

Outcomes