<?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: offline map error: The online map must have an item property which is its online portal item in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/offline-map-error-the-online-map-must-have-an-item/m-p/1327389#M7658</link>
    <description>&lt;P&gt;That is expected. The offline map task works only with webmaps. You cannot simply create a map in code to take offline in this way.&amp;nbsp;&lt;BR /&gt;You have 2 options -&amp;nbsp;&lt;BR /&gt;1) You can create a webmap in ArcGIS Online or your on-premise ArcGIS Enterprise, enable offline settings on it, and then take it offline using the code above. Here is some &lt;A href="https://developers.arcgis.com/ios/offline-maps-scenes-and-data/download-an-offline-map-on-demand/" target="_self"&gt;doc&lt;/A&gt; that describes this workflow.&lt;BR /&gt;2) If you choose to assemble a map in code like you are doing above, you'll need to take basemap and operational layers offline individually using the appropriate tasks. We have samples that show this for&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://developers.arcgis.com/ios/swift/sample-code/generate-geodatabase-replica-from-feature-service/" target="_self"&gt;AGSGeodatabaseSyncTask&lt;/A&gt; (for feature layers),&amp;nbsp;&lt;A href="https://developers.arcgis.com/ios/swift/sample-code/export-tiles/" target="_self"&gt;AGSExportTileCacheTask&lt;/A&gt; (for tiled layers) and&amp;nbsp;&lt;A href="https://developers.arcgis.com/ios/swift/sample-code/export-vector-tiles/" target="_self"&gt;AGSArcGISVectorTiledLayer&lt;/A&gt; (for vector tiled layers).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Sep 2023 17:59:04 GMT</pubDate>
    <dc:creator>DiveshGoyal</dc:creator>
    <dc:date>2023-09-11T17:59:04Z</dc:date>
    <item>
      <title>offline map error: The online map must have an item property which is its online portal item</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/offline-map-error-the-online-map-must-have-an-item/m-p/1323786#M7657</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;Hello, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I want to generate offline map for selected area on the mobile app itself. In the below code I want to generate offline map using the online map which has style&amp;nbsp;.arcGISTopographic. But while I taped on generate offline map&amp;nbsp;&lt;/SPAN&gt;button. I am getting an error :&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2023-08-30 13:13:20.348644+0530 offline map[61063:5199564] ArcGIS Runtime Error Occurred. Set a breakpoint on C++ exceptions to see the original callstack and context for this error:&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;Error Domain=com.esri.arcgis.runtime.error Code=6 "Illegal state." UserInfo={NSLocalizedFailureReason=Offline map task failed to load while generating default parameters for generating an offline map.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The online map must have an item property which is its online portal item., NSLocalizedDescription=Illegal state., Additional Message=Offline map task failed to load while generating default parameters for generating an offline map.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The online map must have an item property which is its online portal item.}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;So shouldn't I create the offline map using Online map without using the portal ID? As I am simply creating the offline map without using specific webMap or any layer so why do we need the portal item.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help me to resolve above issue?&lt;/P&gt;&lt;P&gt;Please find the code below.&lt;/P&gt;&lt;P&gt;error is generated at line -&amp;gt; offlineMapTask.defaultGenerateOfflineMapParameters(withAreaOfInterest: &lt;SPAN&gt;areaOfInterest&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;@IBOutlet&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;weak&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;var&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;mapView&lt;/SPAN&gt;: AGSMapView!{&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;didSet&lt;/STRONG&gt;&lt;/SPAN&gt; {&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;mapView&lt;/SPAN&gt;.&lt;SPAN&gt;map&lt;/SPAN&gt; = &lt;SPAN&gt;makeMap&lt;/SPAN&gt;()&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;// Set inset of overlay.&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; padding: &lt;SPAN&gt;CGFloat&lt;/SPAN&gt; = &lt;SPAN&gt;30&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;mapView&lt;/SPAN&gt;.&lt;SPAN&gt;layoutMargins&lt;/SPAN&gt; = &lt;SPAN&gt;UIEdgeInsets&lt;/SPAN&gt;(&lt;SPAN&gt;top&lt;/SPAN&gt;: padding, &lt;SPAN&gt;left&lt;/SPAN&gt;: padding, &lt;SPAN&gt;bottom&lt;/SPAN&gt;: padding, &lt;SPAN&gt;right&lt;/SPAN&gt;: padding)&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;func&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;makeMap&lt;/SPAN&gt;() -&amp;gt; AGSMap {&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; map = AGSMap(basemapStyle: .arcGISTopographic)&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;map.&lt;SPAN&gt;load&lt;/SPAN&gt; { [&lt;SPAN&gt;&lt;STRONG&gt;weak&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;self&lt;/STRONG&gt;&lt;/SPAN&gt;] _ &lt;SPAN&gt;&lt;STRONG&gt;in&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;self&lt;/STRONG&gt;&lt;/SPAN&gt;?.&lt;SPAN&gt;mapDidLoad&lt;/SPAN&gt;() }&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;return&lt;/STRONG&gt;&lt;/SPAN&gt; map&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;@IBAction&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;func&lt;/STRONG&gt;&lt;/SPAN&gt; generateBtnTapped&lt;SPAN&gt;(&lt;/SPAN&gt;_&lt;SPAN&gt; sender: &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;Any&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; offlineMapTask = AGSOfflineMapTask(onlineMap: &lt;SPAN&gt;mapView&lt;/SPAN&gt;.&lt;SPAN&gt;map&lt;/SPAN&gt;!)&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;offlineMapTask.defaultGenerateOfflineMapParameters(withAreaOfInterest: &lt;SPAN&gt;areaOfInterest&lt;/SPAN&gt;) { [&lt;SPAN&gt;&lt;STRONG&gt;weak&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;self&lt;/STRONG&gt;&lt;/SPAN&gt;] &lt;SPAN&gt;parameters&lt;/SPAN&gt;, &lt;SPAN&gt;error&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;in&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;guard&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; self = &lt;SPAN&gt;&lt;STRONG&gt;self&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;else&lt;/STRONG&gt;&lt;/SPAN&gt; {&lt;SPAN&gt;&lt;STRONG&gt;return&lt;/STRONG&gt;&lt;/SPAN&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 07:58:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/offline-map-error-the-online-map-must-have-an-item/m-p/1323786#M7657</guid>
      <dc:creator>KAMLESHDURGUDE</dc:creator>
      <dc:date>2023-08-30T07:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: offline map error: The online map must have an item property which is its online portal item</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/offline-map-error-the-online-map-must-have-an-item/m-p/1327389#M7658</link>
      <description>&lt;P&gt;That is expected. The offline map task works only with webmaps. You cannot simply create a map in code to take offline in this way.&amp;nbsp;&lt;BR /&gt;You have 2 options -&amp;nbsp;&lt;BR /&gt;1) You can create a webmap in ArcGIS Online or your on-premise ArcGIS Enterprise, enable offline settings on it, and then take it offline using the code above. Here is some &lt;A href="https://developers.arcgis.com/ios/offline-maps-scenes-and-data/download-an-offline-map-on-demand/" target="_self"&gt;doc&lt;/A&gt; that describes this workflow.&lt;BR /&gt;2) If you choose to assemble a map in code like you are doing above, you'll need to take basemap and operational layers offline individually using the appropriate tasks. We have samples that show this for&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://developers.arcgis.com/ios/swift/sample-code/generate-geodatabase-replica-from-feature-service/" target="_self"&gt;AGSGeodatabaseSyncTask&lt;/A&gt; (for feature layers),&amp;nbsp;&lt;A href="https://developers.arcgis.com/ios/swift/sample-code/export-tiles/" target="_self"&gt;AGSExportTileCacheTask&lt;/A&gt; (for tiled layers) and&amp;nbsp;&lt;A href="https://developers.arcgis.com/ios/swift/sample-code/export-vector-tiles/" target="_self"&gt;AGSArcGISVectorTiledLayer&lt;/A&gt; (for vector tiled layers).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 17:59:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/offline-map-error-the-online-map-must-have-an-item/m-p/1327389#M7658</guid>
      <dc:creator>DiveshGoyal</dc:creator>
      <dc:date>2023-09-11T17:59:04Z</dc:date>
    </item>
  </channel>
</rss>

