<?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: Fatal error: Object is already in use and may not be reused in Swift Maps SDK Questions</title>
    <link>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1476935#M285</link>
    <description>&lt;P&gt;I believe you can't have the same graphic layer at the same time.&amp;nbsp; Has the layer been removed from the online map?&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2024 14:12:13 GMT</pubDate>
    <dc:creator>DuanePfeiffer</dc:creator>
    <dc:date>2024-05-22T14:12:13Z</dc:date>
    <item>
      <title>Fatal error: Object is already in use and may not be reused</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1476832#M284</link>
      <description>&lt;P&gt;I have two ArcGIS Maps, one for online and one for offline maps.&lt;/P&gt;&lt;P&gt;There are objects (graphicsOverlay) assigned to the online map and once I download a map, I'd expect to see the same graphics overlays (objects) on the map if they were part of the area that were downloaded.&lt;/P&gt;&lt;P&gt;This was working on 100.x but now I'm migrating to 200.x and I receive the following:&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;ArcGIS/CoreMutableArray.swift:47: Fatal error: Object is already in use and may not be reused.&lt;/LI-CODE&gt;&lt;P&gt;This happens when I try to append an ArcGIS.GraphicsOverlay object to the model of my offline map.&lt;/P&gt;&lt;P&gt;If I remove this line, the offline map renders correctly without the objects.&lt;/P&gt;&lt;P&gt;Can it be that one GraphicsOverlay object cannot be used on more than one SwiftUI ArcGIS.Map? Or is it a bug?&lt;/P&gt;&lt;P&gt;I also changed simply changing the grraphicsOverlay's id to some unique value but still no luck.&lt;/P&gt;&lt;P&gt;Thank youl&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 11:02:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1476832#M284</guid>
      <dc:creator>zdtorok</dc:creator>
      <dc:date>2024-05-22T11:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: Fatal error: Object is already in use and may not be reused</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1476935#M285</link>
      <description>&lt;P&gt;I believe you can't have the same graphic layer at the same time.&amp;nbsp; Has the layer been removed from the online map?&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 14:12:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1476935#M285</guid>
      <dc:creator>DuanePfeiffer</dc:creator>
      <dc:date>2024-05-22T14:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Fatal error: Object is already in use and may not be reused</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1476990#M286</link>
      <description>&lt;P&gt;A specific Graphics Overlay instance can only be part of one MapView at a time. If you are showing the MapViews at the same time then it's something that will have to change at your app level (ie. clone the overlay). If you are not showing the map views at the same time, but in succession, then please try 200.4 as we made some changes in that version that help with issues like that.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 15:05:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1476990#M286</guid>
      <dc:creator>rolson_esri</dc:creator>
      <dc:date>2024-05-22T15:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Fatal error: Object is already in use and may not be reused</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1477594#M289</link>
      <description>&lt;P&gt;I have a model where I have the graphicsOverlays, see this:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var body: some View {
        ArcGIS.MapViewReader { proxy in
            ArcGIS.MapView(map: model.map,
                           viewpoint: model.viewpoint,
                           graphicsOverlays: model.graphicsOverlays)
            ...
        }
    }
}   &lt;/LI-CODE&gt;&lt;P&gt;The two Maps are nested in an `UIViewController` as this is a legacy code which we are updating from 100.x to 200.x. Basically I hide/show the two UIViewControllers when there is a change.&lt;/P&gt;&lt;P&gt;When I want to show the offline map:&lt;/P&gt;&lt;P&gt;1. I remove the graphicsOverlays from the online map's model with `graphicsOverlays.removeAll()`&lt;BR /&gt;2. Add the new graphicsOverlays to the offline map's model.&lt;/P&gt;&lt;P&gt;Is there something else that I'm missing in this concept?&lt;/P&gt;&lt;P&gt;I'm already using 200.4.&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 12:31:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1477594#M289</guid>
      <dc:creator>zdtorok</dc:creator>
      <dc:date>2024-05-23T12:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Fatal error: Object is already in use and may not be reused</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1477598#M290</link>
      <description>&lt;P&gt;Yes, I just replied to the other comment, but I called `graphicsOverlays.removeAll()` from my model that is used by the SwiftUI Map for the online UIViewController and added the graphics with `.append(...)` to the offline map.&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 12:32:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1477598#M290</guid>
      <dc:creator>zdtorok</dc:creator>
      <dc:date>2024-05-23T12:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Fatal error: Object is already in use and may not be reused</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1477599#M291</link>
      <description>&lt;P&gt;Also, how does it check if a Graphics Overlay is assigned to more than one MapView? Based on its ID or there is some reference on the Graphics Overlay to the assigned MapView that I could check?&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 12:34:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1477599#M291</guid>
      <dc:creator>zdtorok</dc:creator>
      <dc:date>2024-05-23T12:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Fatal error: Object is already in use and may not be reused</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1477661#M292</link>
      <description>&lt;P&gt;If the overlay is removed from the first MapView before added to the second MapView then it should work. If the timing isn't correct you will get this error. Can you send us code that reproduces the problem you are seeing and we can try to debug it.&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 14:16:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1477661#M292</guid>
      <dc:creator>rolson_esri</dc:creator>
      <dc:date>2024-05-23T14:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: Fatal error: Object is already in use and may not be reused</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1477662#M293</link>
      <description>&lt;P&gt;It's based on the instance, so it's the actual reference. You could check ObjectIdentifier(...) for equality or you could check identity equality (`===`). If the problem persists, you can clone the overlay but that solution might not work for you if you are mutating it.&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 14:17:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/fatal-error-object-is-already-in-use-and-may-not/m-p/1477662#M293</guid>
      <dc:creator>rolson_esri</dc:creator>
      <dc:date>2024-05-23T14:17:13Z</dc:date>
    </item>
  </channel>
</rss>

