How to clear mkmapview cache

In my application. I have one text box and one search button. When the user clicks the search button after filling in the address in the text box, my application shows the result and puts the output on the map. I use google maps api for this. I also added that the user can drag the pin. when the user drags the contact and falls to another place. The previous output should be deleted. To remove this output, I use [mapView removeAnnotation [mapView.annotations lastObject]];

but when I search again for a new address that is already a search. He again created a new conclusion. I know this comes from the mkmapview cache. ** Now, how can I remove it (pin) from mkmapview

+1
source share
2 answers

try it

NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil]; 

[NSURLCache setSharedURLCache:sharedCache];
 [sharedCache release];
+2
source

Just update since I was looking for this. It seems a little cleaner

[[NSURLCache sharedURLCache] removeAllCachedResponses];
0
source

Source: https://habr.com/ru/post/1547471/


All Articles