Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift 4.0 MapView Running Slow

Ever since I updated to Xcode 9 and Swift 4.0, my mapView in my simulator has been running extremely slow. I thought this would be because code would be deprecated or because my code was extensive causing it to slow down, but I added a mapView into a blank project and that mapView is slow to navigate/zoom as well! Are there some settings I need to configure to fix this in the simulator?

This is the output produced in the console log:

2017-10-26 23:25:50.932530-0500 mapTest[7994:151068] [VKDefault] Tile 1.2.2 (256) in current unloaded state for 0.07 seconds - Polygons - Loading (ephemeral) (0.07 sec), Rivers - Loading (ephemeral) (0.07 sec), Roads - Loading (ephemeral) (0.07 sec), Point Labels - Loading (ephemeral) (0.07 sec), Polygon Labels - Loading (ephemeral) (0.07 sec), Road Labels - Loading (ephemeral) (0.07 sec), Resources - Unavailable (terminal) (2.11 sec), Attributes - Loading (ephemeral) (0.07 sec)
like image 844
Kevin Avatar asked Oct 27 '17 04:10

Kevin


Video Answer


1 Answers

If this is just in the simulator for ios 11 or 10.3, then it is a known bug. The XCode 9 simulator is working very slowly for everyone relating to mapKit. This bug can be seen here and here. It should, however, work fine if you use the app on your phone.

Apple staff working with Swift development have acknowledged the issue. The only workaround currently is using the ios 10 simulator or changing the rendering modules (suggested by Apple staff). Supposedly, changing the modules isnt perfect, but it might just help. Type this in terminal:

defaults write com.apple.CoreSimulator.IndigoFramebufferServices FramebufferRendererHint X

Replace the X with: 0 = auto, 1 = Metal, 2 = OpenCL, 3 = OpenGL

Again, this is an official bug in the simulator so changing the rendering still won't make the simulation perfect. There have been 4-5 people who have submitted bug reports on this and it has been acknowledged, so hopefully a fix comes soon.

Edit

I tried a map kit app on iOS 11.1 simulator. It seems to be slightly smoother but the error message still pops up... waiting for a fix

Edit

A comment pointed out that this is fixed in the iOS 11.3 beta.

like image 147
Saransh Malik Avatar answered Sep 28 '22 08:09

Saransh Malik