<?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: Error downloading basemap using AGSOfflineMapTask in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/error-downloading-basemap-using-agsofflinemaptask/m-p/163867#M1515</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That error is saying that you have not provided credentials to download the basemap. To download Esri basemaps you need to provide a login. You can provide a free developer account login if you need to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you create the&amp;nbsp;&lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_generate_offline_map_job.html"&gt;&lt;STRONG&gt;AGSGenerateOfflineMapJob&lt;/STRONG&gt;&lt;/A&gt;, you can provide a &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_credential.html"&gt;&lt;STRONG&gt;AGSCredential&lt;/STRONG&gt;&lt;/A&gt; on the &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/protocol_a_g_s_remote_resource-p.html#abb19295e652aae93308555206ddf6532"&gt;&lt;STRONG&gt;credential&lt;/STRONG&gt;&lt;/A&gt; property.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Nov 2020 22:45:14 GMT</pubDate>
    <dc:creator>Nicholas-Furness</dc:creator>
    <dc:date>2020-11-04T22:45:14Z</dc:date>
    <item>
      <title>Error downloading basemap using AGSOfflineMapTask</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/error-downloading-basemap-using-agsofflinemaptask/m-p/163866#M1514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using AGSOfflineMapTask (iOS SDK) to&amp;nbsp;try and download the full contents of a map. The map is using a basemap generated from a portal item ID defined here:&amp;nbsp;&lt;A class="link-titled" href="https://www.arcgis.com/home/item.html?id=3e1a00aeae81496587988075fe529f71" title="https://www.arcgis.com/home/item.html?id=3e1a00aeae81496587988075fe529f71"&gt;https://www.arcgis.com/home/item.html?id=3e1a00aeae81496587988075fe529f71&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When calling getOfflineMapCapabilities none of the layers or basemap are returning that they are not downloadable, and therefore I believe I should be able to download the open street map basemap, however when I try to create an offline map job and call `start` a login screen is shown to the user, and downloading of the basemap fails with an error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error Domain=NSCocoaErrorDomain Code=3072 "User canceled error" UserInfo={NSLocalizedDescription=User canceled error, NSUnderlyingError=0x60000018b450 {Error Domain=com.esri.arcgis.runtime.services.error Code=499 "Token Required"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there anything that can be done to allow download of this layer?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Nov 2020 13:10:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/error-downloading-basemap-using-agsofflinemaptask/m-p/163866#M1514</guid>
      <dc:creator>SimonMitchell</dc:creator>
      <dc:date>2020-11-04T13:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Error downloading basemap using AGSOfflineMapTask</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/error-downloading-basemap-using-agsofflinemaptask/m-p/163867#M1515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That error is saying that you have not provided credentials to download the basemap. To download Esri basemaps you need to provide a login. You can provide a free developer account login if you need to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you create the&amp;nbsp;&lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_generate_offline_map_job.html"&gt;&lt;STRONG&gt;AGSGenerateOfflineMapJob&lt;/STRONG&gt;&lt;/A&gt;, you can provide a &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_credential.html"&gt;&lt;STRONG&gt;AGSCredential&lt;/STRONG&gt;&lt;/A&gt; on the &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/protocol_a_g_s_remote_resource-p.html#abb19295e652aae93308555206ddf6532"&gt;&lt;STRONG&gt;credential&lt;/STRONG&gt;&lt;/A&gt; property.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Nov 2020 22:45:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/error-downloading-basemap-using-agsofflinemaptask/m-p/163867#M1515</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2020-11-04T22:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Error downloading basemap using AGSOfflineMapTask</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/error-downloading-basemap-using-agsofflinemaptask/m-p/163868#M1516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the quick response Nicholas, so just to confirm:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Setting the license key isn't enough here?&lt;BR /&gt;2. Using a free developer account is okay for a production release of the app where a significant amount of users could be downloading the basemap on a semi-regular basis?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've just attempted this &lt;A href="https://community.esri.com/migrated-users/2201" target="_blank"&gt;Nicholas Furness&lt;/A&gt;‌ and unfortunately the login details I have used don't seem to be resolving this issue. One thing to note is that I have a license key provided by the client, but the username and password I am using (We haven't asked them for this yet) is for my personal account. Do the username/login need to be from the same account as the license key?&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;If I login using the alert prompt that shows to try and authenticate me then it works flawlessly... Is there somewhere else that I also need to provide the credential? I am doing so by setting it on the task returned by the&amp;nbsp;generateOfflineMapJob call as suggested.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: It seems I&amp;nbsp;&lt;EM&gt;may&amp;nbsp;&lt;/EM&gt;have resolved this... I have also set the credential on the AGSPortal used to initially create the basemap when rendering the online version of the map, is that expected behaviour that it needs to be set in both places? If so, I'm happy that this has been resolved!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class=""&gt;extension&lt;/SPAN&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;AGSBasemap&lt;SPAN class=""&gt; {&lt;/SPAN&gt;
&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class=""&gt;convenience&lt;/SPAN&gt; &lt;SPAN class=""&gt;init&lt;/SPAN&gt;(itemId: &lt;SPAN class=""&gt;String&lt;/SPAN&gt;) {
&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class=""&gt;let&lt;/SPAN&gt; portal = AGSPortal.arcGISOnline(withLoginRequired: &lt;SPAN class=""&gt;false&lt;/SPAN&gt;)
&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;portal.credential = HaitiMap.credential // Setting credential here too!
&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class=""&gt;let&lt;/SPAN&gt; item = AGSPortalItem(portal: portal, itemID: itemId)
&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class=""&gt;let&lt;/SPAN&gt; vectorTileLayer = AGSArcGISVectorTiledLayer(item: item)
&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class=""&gt;self&lt;/SPAN&gt;.init(baseLayer: vectorTileLayer)
&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:07:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/error-downloading-basemap-using-agsofflinemaptask/m-p/163868#M1516</guid>
      <dc:creator>SimonMitchell</dc:creator>
      <dc:date>2021-12-12T16:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Error downloading basemap using AGSOfflineMapTask</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/error-downloading-basemap-using-agsofflinemaptask/m-p/163869#M1517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="background-color: #ffffff;"&gt;1. Setting the license key isn't enough here?&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Quite so. The license enables (or disables) functionality in Runtime, but does not impact authentication. That's where the username/password or other type of credential comes in. That's what determines whether and how you can access a resource.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="background-color: #ffffff;"&gt;2. Using a free developer account is okay for a production release of the app where a significant amount of users could be downloading the basemap on a semi-regular basis?&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, it is. But if you're earning any revenue off the app (through App Store sales or ads, for example) then you need to make sure you have a paid &lt;A href="https://developers.arcgis.com/pricing/"&gt;Builder Plan&lt;/A&gt; for what&amp;nbsp;we call a commercial deployment. If it's a free app, you can stick with the free&amp;nbsp;&lt;A href="https://developers.arcgis.com/pricing/"&gt;Essentials Plan&lt;/A&gt;. See&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/ios/latest/swift/guide/deployment.htm" title="https://developers.arcgis.com/ios/latest/swift/guide/deployment.htm"&gt;Deploy your app—ArcGIS Runtime SDK for iOS | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&amp;nbsp;for more info.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Back to authentication: If you're just authenticating to access the basemap services, you can use App Logins (Client ID + Client Secret). In fact, you should. It's something of an anti pattern to embed your username and password into the app. The short of it is you create an Application at &lt;A class="link-titled" href="https://developers.arcgis.com/applications/new" title="https://developers.arcgis.com/applications/new"&gt;ArcGIS for Developers&lt;/A&gt;, and that gives you a ClientID + Client Secret. You can use those to get a Token from ArcGIS Online, and that can be used to download the Basemaps without ever prompting the user for a login. The AuthenticationManager can make this seamless (see the Gist below). See these resources for some more info:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/documentation/core-concepts/security-and-authentication/accessing-arcgis-online-services/" title="https://developers.arcgis.com/documentation/core-concepts/security-and-authentication/accessing-arcgis-online-services/"&gt;Implementing App Login | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;A class="link-titled" href="https://gist.github.com/nixta/33afa1a17d7a9ea85f0d2d601e55a79f" title="https://gist.github.com/nixta/33afa1a17d7a9ea85f0d2d601e55a79f"&gt;App ID (swift codable) · GitHub&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/ios/latest/swift/guide/access-the-arcgis-platform.htm" title="https://developers.arcgis.com/ios/latest/swift/guide/access-the-arcgis-platform.htm"&gt;Access the ArcGIS platform—ArcGIS Runtime SDK for iOS | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;A class="link-titled" href="https://nshipster.com/secrets/" title="https://nshipster.com/secrets/"&gt;Secret Management on iOS - NSHipster&lt;/A&gt;&amp;nbsp;(definitely worth a read before you embed stuff in your app!).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="background-color: #ffffff;"&gt;I have also set the credential on the AGSPortal&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Interesting.&amp;nbsp;I'll run that past some folks on the offline team here and see if that's expected. It's quite possible that it is and I've just made an assumption I shouldn't have!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Nov 2020 16:16:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/error-downloading-basemap-using-agsofflinemaptask/m-p/163869#M1517</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2020-11-05T16:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Error downloading basemap using AGSOfflineMapTask</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/error-downloading-basemap-using-agsofflinemaptask/m-p/163870#M1518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the above again! &lt;IMG class="jive_emoji" src="https://community.esri.com/images/emojis/263a.png" /&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Quite so. The license enables (or disables) functionality in Runtime, but does not impact authentication. That's where the username/password or other type of credential comes in. That's what determines whether and how you can access a resource.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Makes sense in terms of the license key, thanks for explaining that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Yes, it is. But if you're earning any revenue off the app (through App Store sales or ads, for example) then you need to make sure you have a paid &lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fdevelopers.arcgis.com%2Fpricing%2F" rel="nofollow" target="_blank"&gt;Builder Plan&lt;/A&gt; for what&amp;nbsp;we call a commercial deployment. If it's a free app, you can stick with the free&amp;nbsp;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fdevelopers.arcgis.com%2Fpricing%2F" rel="nofollow" target="_blank"&gt;Essentials Plan&lt;/A&gt;. See&amp;nbsp;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fdevelopers.arcgis.com%2Fios%2Flatest%2Fswift%2Fguide%2Fdeployment.htm" rel="nofollow" target="_blank"&gt;Deploy your app—ArcGIS Runtime SDK for iOS | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&amp;nbsp;for more info.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thank you for that, this is for a client (The global disaster preparedness centre) to go in as a new feature to their First Aid app so it isn't for profit and never will be, that's good to know!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Back to authentication: If you're just authenticating to access the basemap services, you can use App Logins (Client ID + Client Secret). In fact, you should.&amp;nbsp;I have also set the credential on the AGSPortal&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;And thanks yet again! Those links were really helpful, and that seems like a far more robust solution than setting the credential object all over the place, 100% didn't want to be using username/password and will definitely consider abstracting the client id and secret too!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you have a nice weekend!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Nov 2020 17:02:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/error-downloading-basemap-using-agsofflinemaptask/m-p/163870#M1518</guid>
      <dc:creator>SimonMitchell</dc:creator>
      <dc:date>2020-11-06T17:02:55Z</dc:date>
    </item>
  </channel>
</rss>

