How to remove a webmap from AGSMapView programatically

534
3
05-09-2013 06:24 PM
HumzaAkhtar
Occasional Contributor II
Hi,

It seems like a basic question but does any one has any idea on how to remove a webmap from a mapview. By removing I mean deleting the webmap? There seems to be no 'Remove Webmap' method available in the AGSWebMap class.


thanks
Humza
0 Kudos
3 Replies
NimeshJarecha
Esri Regular Contributor
AGSWebMap is nothing but a container with multiple layers which you open into map view (AGSMapView). In order to remove all layer from a map you call reset on map view ([self.mapView reset]).

If you want to load another webmap in the same map view then you just open another webmap and it'll take care of removing layers of earlier webmap.

Hope this helps!

Regards,
Nimesh
0 Kudos
AhmedKhattab
New Contributor
Hi Nimesh,

After upgrading to 10.1.1 Update 1, using the [mapView reset] causes the application to crash.

And gives the error :

libc++abi.dylib: terminate called without an active exception

Below is the Stack :

MapTest`-[AGSMapRenderer pulse:] at AGSMapRenderer_iOS.mm:109:
0xe800:  pushl  %ebp
0xe801:  movl   %esp, %ebp
0xe803:  pushl  %edi
0xe804:  pushl  %esi
0xe805:  subl   $16, %esp
0xe808:  calll  0xe80d                    ; -[AGSMapRenderer pulse:] + 13 at AGSMapRenderer_iOS.mm:110
0xe80d:  popl   %esi
0xe80e:  movl   13551367(%esi), %eax
0xe814:  movl   8(%ebp), %edi
0xe817:  addl   %edi, %eax
0xe819:  movl   %eax, (%esp)
0xe81c:  calll  0x913aee                  ; symbol stub for: objc_loadWeak
0xe821:  movl   13481427(%esi), %ecx
0xe827:  movl   %ecx, 4(%esp)
0xe82b:  movl   %eax, (%esp)
0xe82e:  calll  0x913afa                  ; symbol stub for: objc_msgSend
0xe833:  movl   13551371(%esi), %eax
0xe839:  movl   (%edi,%eax), %eax
0xe83c:  cmpl   $0, 28(%eax)
0xe840:  je     0xe850                    ; -[AGSMapRenderer pulse:] + 80 at support.h:117
0xe842:  movl   $5, (%esp)
0xe849:  calll  0x914304                  ; symbol stub for: raise
0xe84e:  jmp    0xe858                    ; -[AGSMapRenderer pulse:] + 88 at AGSMapRenderer_iOS.mm:112
0xe850:  movl   %eax, (%esp)
0xe853:  calll  0x5f8f60                  ; Esri_runtimecore::Mapping::Map::on_pulse_()
0xe858:  addl   $16, %esp
0xe85b:  popl   %esi
0xe85c:  popl   %edi
0xe85d:  popl   %ebp
0xe85e:  ret   


Regards,
Ahmed Khattab
0 Kudos
DiveshGoyal
Esri Regular Contributor
Ahmed,

Can you provide a small testcase to repro this error? I can't repro it on my end.
0 Kudos