<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Loading legend is difficult when using authentication in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690775#M6141</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Rene,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Which version of the API are you using? v1.8 or v2.0?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Is HTTP authentication Basic or Digest?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Is SSL enabled on the server?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nimesh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Jul 2011 15:41:41 GMT</pubDate>
    <dc:creator>NimeshJarecha</dc:creator>
    <dc:date>2011-07-27T15:41:41Z</dc:date>
    <item>
      <title>Loading legend is difficult when using authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690773#M6139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We were using the legend example from the website (&lt;/SPAN&gt;&lt;A href="http://www.arcgis.com/home/item.html?id=901ca5cbcc6e4fe9bee960136c5971ba" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.arcgis.com/home/item.html?id=901ca5cbcc6e4fe9bee960136c5971ba&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This worked like a charm, but when we enabled the authentication on the mapserver (HTTP authentication), it stopped working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why? In the statement&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AGSMapServiceInfo* msi = ((AGSDynamicMapServiceLayer*)layer).mapServiceInfo;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;is the MapServiceInfo allocated, but there are no credentials available! These are not copied from the layer itself, nor is done when the DynamicMapServiceLayer from the mapview is used to retrieve the MapServiceInfo.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this wanted? Because it is NOT possible to set the credentials, without recreating the whole object...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The quick and dirty fix i've used now is: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AGSMapServiceInfo* msi = [[AGSMapServiceInfo alloc] initWithURL:self.mapView.dynamicLayer.URL credential:self.mapView.dynamicLayer.credential error:&amp;amp;error];&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This works, because there is only one dynamic layer, and only one layer (the dynamic layer) which uses the legend.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's still work in progress, but this is the code as used:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NSError* error = nil;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AGSMapServiceInfo* msi;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (((AGSDynamicMapServiceLayer*)layer).credential.authType == AGSAuthenticationTypeNone){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msi = ((AGSDynamicMapServiceLayer*)layer).mapServiceInfo;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msi = [[[AGSMapServiceInfo alloc] initWithURL:self.mapView.dynamicLayer.URL credential:self.mapView.dynamicLayer.credential error:&amp;amp;error] autorelease];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (error)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NSLog(@"Error encountered while fetching legend : %@",error);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(msi.version&amp;gt;=10.01){ 
&amp;nbsp;&amp;nbsp; msi.delegate = self;
&amp;nbsp;&amp;nbsp; [msi retrieveLegendInfo];
&amp;nbsp; }else {
&amp;nbsp;&amp;nbsp; NSLog(@"Skipping layer [%@]. ArcGIS Service must be version 10 SP1 or above",msi.URL );
&amp;nbsp; }
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But, it didn't work in the beginning as expected. The application gave JSON paring errors, which didn't make sense.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;After a lot of research, we've found the reason: There was an "#" in the password. The legend is retrieved through &lt;/SPAN&gt;&lt;A href="http://user:password@url/MapServer/layers?f=json" rel="nofollow noopener noreferrer" target="_blank"&gt;http://user:password@url/MapServer/layers?f=json&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Because of the # the application couldn't find the used mapserver. I guess the same is applicable for the "/" or "\", and maybe even "&amp;amp;"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The strange part is: With the same authentication, the mapserver itself (The map data) can be loaded...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess this last one is a bug... It's rather dirty anyway to put the credentials in an url..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, i really want to know if my findings are correct, and if it's a bug, or something else.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:04:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690773#M6139</guid>
      <dc:creator>ReneNijkamp</dc:creator>
      <dc:date>2021-12-12T05:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: Loading legend is difficult when using authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690774#M6140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Changed the code a bit, this seems to work flawless:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NSURL* layerUrl = [((AGSDynamicMapServiceLayer*)layer).URL copy];
&amp;nbsp; //Get the service info
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NSError* error = nil;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AGSCredential* cred = [[AGSCredential alloc] initWithUser:((AGSDynamicMapServiceLayer*)layer).credential.username password:((AGSDynamicMapServiceLayer*)layer).credential.password authenticationType:[AGSCredential isServiceSecured:layerUrl]];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msi = [[AGSMapServiceInfo alloc] initWithURL:layerUrl credential:cred error:&amp;amp;error];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (error)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NSLog(@"Error encountered while fetching legend : %@",error);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(msi.version&amp;gt;=10.01){ 
&amp;nbsp;&amp;nbsp; msi.delegate = self;
&amp;nbsp;&amp;nbsp; [msi retrieveLegendInfo];
&amp;nbsp; }else {
&amp;nbsp;&amp;nbsp; NSLog(@"Skipping layer [%@]. ArcGIS Service must be version 10 SP1 or above",msi.URL );
&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [layerUrl release];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [cred release];&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note: This is only for the dynamic layer. Since we dont use feature or tiled layers, we didn't implement the legend for these types of layers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But still, is this wanted behaviour? I would rather have that the ((AGSDynamicMapServiceLayer*)layer).mapserviceinfo (The MSI from the loaded layer) contains the credentials..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And than there is the password problem (#, /, \ in passwords result in non-loadable MapServiceInfo's)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:04:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690774#M6140</guid>
      <dc:creator>ReneNijkamp</dc:creator>
      <dc:date>2021-12-12T05:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: Loading legend is difficult when using authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690775#M6141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Rene,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Which version of the API are you using? v1.8 or v2.0?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Is HTTP authentication Basic or Digest?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Is SSL enabled on the server?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nimesh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2011 15:41:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690775#M6141</guid>
      <dc:creator>NimeshJarecha</dc:creator>
      <dc:date>2011-07-27T15:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: Loading legend is difficult when using authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690776#M6142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Rene,&lt;BR /&gt;&lt;BR /&gt;1. Which version of the API are you using? v1.8 or v2.0?&lt;BR /&gt;2. Is HTTP authentication Basic or Digest?&lt;BR /&gt;3. Is SSL enabled on the server?&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Nimesh&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. v1.8, we don't want to migrate to v2.0 in this stadium (Deadline coming up)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. I asked the dude which manages the server side: Both, including Windows Authentication&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. SSL is NOT enabled. (Internal Server)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 07:22:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690776#M6142</guid>
      <dc:creator>ReneNijkamp</dc:creator>
      <dc:date>2011-07-28T07:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: Loading legend is difficult when using authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690777#M6143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That was an issue at v1.8 but fixed in v2.0. You can test it and decide whether to upgrade or not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;IMHO, there is no risk in upgrading to v2.0. It has additional feature called popups, bug fixes and performance improvement in Graphics/Feature layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nimesh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 15:03:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690777#M6143</guid>
      <dc:creator>NimeshJarecha</dc:creator>
      <dc:date>2011-07-28T15:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Loading legend is difficult when using authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690778#M6144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What do you mean by this, the authentication problem (The disappearing credentials) or the failure with the "#" in the password, or both? &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jul 2011 06:27:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690778#M6144</guid>
      <dc:creator>ReneNijkamp</dc:creator>
      <dc:date>2011-07-29T06:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Loading legend is difficult when using authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690779#M6145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The disappearing credential in AGSMapServiceInfo is fixed at v2.0. I don't see any problem in password having "#". I tested Tiled and Dynamic map services with password "#t/" and it works at v1.8 and v2.0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nimesh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jul 2011 16:01:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/loading-legend-is-difficult-when-using/m-p/690779#M6145</guid>
      <dc:creator>NimeshJarecha</dc:creator>
      <dc:date>2011-07-29T16:01:27Z</dc:date>
    </item>
  </channel>
</rss>

