// Get indexes of visible layers AGSMapServiceInfo *dynaServiceInfo = self.dynamicLayer.mapServiceInfo; AGSMapServiceLayerInfo *dynaLayerInfo; NSMutableArray *visibleLayers = [NSMutableArray arrayWithCapacity:[dynaServiceInfo.layerInfos count]]; for (int i = 0; i < [dynaServiceInfo.layerInfos count]; i++) { dynaLayerInfo = [dynaServiceInfo.layerInfos objectAtIndex:i]; if (dynaLayerInfo.visible == YES) { [visibleLayers addObject:[[NSNumber alloc] initWithInt:i]]; } }
AGSMapServiceInfo *serviceInfo = [[AGSMapServiceInfo alloc] initWithURLSynchronous:[NSURL URLWithString:aLayer.url]]; AGSDynamicMapServiceLayer *dynLayer = [[AGSDynamicMapServiceLayer alloc] initWithMapServiceInfo:serviceInfo];
Use this way: AGSMapServiceInfo *serviceInfo = [[AGSMapServiceInfo alloc] initWithURLSynchronous:[NSURL URLWithString:aLayer.url]]; AGSDynamicMapServiceLayer *dynLayer = [[AGSDynamicMapServiceLayer alloc] initWithMapServiceInfo:serviceInfo]; so when you access to dynLayer.mapServiceInfo it will be not empty.
The AGSMapServiceInfo::initWithURLSynchronous has been renamed to AGSMapServiceInfo::initWithURL:error:. Please refer Migration doc for detail of all changes.You can refer ArcGIS Dynamic Map Service Layer doc as well.Regards,Nimesh
NSURL *url = [NSURL URLWithString: @"http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"]; AGSMapServiceInfo *serviceInfo = [AGSMapServiceInfo mapServiceInfoWithURL:url error:nil]; AGSDynamicMapServiceLayer *dynLayerInfo = [AGSDynamicMapServiceLayer dynamicMapServiceLayerWithMapServiceInfo:serviceInfo]; NSString *info = dynLayerInfo.mapServiceInfo.serviceDescription;
You should pass the 'error' like below. It'll be populated if there is an error in creating instance of AGSMapServiceInfo.NSError *error = nil; AGSMapServiceInfo *serviceInfo = [AGSMapServiceInfo mapServiceInfoWithURL:url error:&error];Hope this helps!Regards,Nimesh
NSError *error = nil; NSURL *url = [NSURL URLWithString: @"http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"]; AGSMapServiceInfo *serviceInfo = [AGSMapServiceInfo mapServiceInfoWithURL:url error:&error]; AGSDynamicMapServiceLayer *dynLayerInfo = [AGSDynamicMapServiceLayer dynamicMapServiceLayerWithMapServiceInfo:serviceInfo]; NSString *info = dynLayerInfo.mapServiceInfo.serviceDescription; UIAlertView *vModal = [[UIAlertView alloc] initWithTitle:@Map Service error message:info delegate:self cancelButtonTitle:@Done otherButtonTitles:nil, nil]; [vModal show]; [vModal release];
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.