mapbox / mbxmapkit

DEPRECATED - Lightweight Mapbox integration with MapKit on iOS
http://mapbox.com/mbxmapkit
Other
335 stars 85 forks source link

MKOverlayRenderer setNeedsDisplayInMapRect:zoomScale: #152

Closed ghost closed 1 year ago

ghost commented 9 years ago

Crashing frequently in 0.7.0

Thread 0 Crashed:
0   libdispatch.dylib                    0x39579af4 _os_object_retain_internal + 32
1   libdispatch.dylib                    0x3957ef8b dispatch_group_notify_f + 92
2   VectorKit                            0x367f9ee1 -[VKRasterOverlayTileSource invalidateRect:level:] + 146
3   VectorKit                            0x367fb15f -[VKRasterOverlay setNeedsDisplayInRect:level:] + 132
4   MapKit                               0x2fb11403 -[MKOverlayRenderer setNeedsDisplayInMapRect:zoomScale:] + 88
5   Navigator2                           0x0037192f __50-[MBXRasterTileRenderer canDrawMapRect:zoomScale:]_block_invoke (MBXRasterTileRenderer.m:236)
6   Navigator2                           0x0036dffb __46-[MBXRasterTileOverlay loadTileAtPath:result:]_block_invoke (MBXRasterTileOverlay.m:323)
7   Navigator2                           0x0036f87f __67-[MBXRasterTileOverlay asyncLoadURL:workerBlock:completionHandler:]_block_invoke (MBXRasterTileOverlay.m:673)
8   Foundation                           0x2f30dde9 __67+[NSURLConnection sendAsynchronousRequest:queue:completionHandler:]_block_invoke_2 + 106
9   Foundation                           0x2f23c64f -[NSBlockOperation main] + 128
10  Foundation                           0x2f22c875 -[__NSOperationInternal _start:] + 770
11  Foundation                           0x2f2d0745 __NSOQSchedule_f + 58
12  libdispatch.dylib                    0x39578d3f _dispatch_client_callout + 20
13  libdispatch.dylib                    0x3957b6c3 _dispatch_main_queue_callback_4CF + 276
14  CoreFoundation                       0x2e8c3681 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 6
15  CoreFoundation                       0x2e8c1f4d __CFRunLoopRun + 1306
16  CoreFoundation                       0x2e82c769 CFRunLoopRunSpecific + 522
17  CoreFoundation                       0x2e82c54b CFRunLoopRunInMode + 104
18  GraphicsServices                     0x337996d3 GSEventRunModal + 136
19  UIKit                                0x3118b891 UIApplicationMain + 1134
20  Navigator2                           0x000cf453 main (main.m:6)
21  libdyld.dylib                        0x3958dab7 start + 0
ghost commented 9 years ago

Hi @sunilvignesh, I think it may be difficult for anyone to respond to this unless you can provide more details about what you were trying to do, what happened, and how that differed from what you were expecting to happen. Sample code from the view controller where you set up your map might be helpful. Also, does the crashing happen in the sample app?

ghost commented 9 years ago

Hmm... actually, @incanus, what about MBXRasterTileOverlayRenderer on threads 4 and 5 MBXRasterTileRenderer on thread 5?

incanus commented 9 years ago

@sunilvignesh Can you give any more info, like mapID, location, and gestures/API used when you see this? MKOverlayRenderer.setNeedsDisplayInMapRect:zoomScale: doesn't list any restrictions around what threads it can be called from, and further, your crashed Thread 0 here is the main thread, so I'm not sure what else we could be doing differently.

FWIW, though, I did encounter three other MapKit bugs when working on this feature...

ghost commented 9 years ago

@wsnook @incanus Sorry for being less verbose. I'm not able to reproduce this effectively. Based on issues reported it usually happens when tile is loading and you move out the view on slow networks. We have subclassed mapview which is a tile overlay delegate of itself. We've have long press gesture on the map and crashes happens on diffferent map ids. All updates are done on main thread.

ghost commented 9 years ago

We have subclassed mapview which is a tile overlay delegate of itself.

@sunilvignesh Well, one possibility is that your problem is the result of subclassing MKMapView. In Apple's MKMapView documentation, in the class description at the top of the page (click the "More..." link), it says they don't want you to do that:

Although you should not subclass the MKMapView class itself, you can get information about the map view’s behavior by providing a delegate object.

Vinzius commented 9 years ago

I encountered this crash too. It happens quite a lot in fact. Usually just after the mapView instantiation. I don't have any special subclass or complicated implementation.