在iOS应用程序中释放SKMap(Skobbler)的内存

Viv*_*hah 5 objective-c map ios skmaps

我正在制作一个使用SKMap(Skobbler)的iOS应用程序.当SKMap打开时,我的应用会占用大量内存.当我移动到应用程序的其他页面时,更多内容不会释放内存.

我在viewWillDisappear方法中放了一些代码来释放SKMap的内存,

[[SKRoutingService sharedInstance].mapView clearAllAnnotations];
[SKRoutingService sharedInstance].routingDelegate = nil;
[SKRoutingService sharedInstance].navigationDelegate=nil;
[[AudioService sharedInstance]cancel];
[[SKRoutingService sharedInstance]stopNavigation];
[[SKRoutingService sharedInstance]clearCurrentRoutes];
[[SKRoutingService sharedInstance]clearAllRoutesFromCache];
[SKRoutingService sharedInstance].mapView = nil;

//self.mapView is SKMap
self.mapView.settings.displayMode = SKMapDisplayMode2D;
self.mapView.delegate=nil;
[self.mapView removeFromSuperview];
self.mapView=nil;
Run Code Online (Sandbox Code Playgroud)

如果您有任何解决方案来释放内存,请帮助我.

Dre*_*rew 0

我写信询问此事,收到了这样的回复:

\n\n
\n

在内部,C++ 代码使用 1 个地图单例,即使在 iOS 地图视图被销毁之后,\n 也会保持地图实例处于活动状态 \xe2\x80\x93 您无法\n 强制 C++ 库在 iOS/Android 级别释放内存。 \n 这个实施决定是在人们认为\n 快速的“映射恢复”过程\n 比小的内存占用更重要的日子里做出的。

\n
\n