I have an iOS app built in RubyMotion (using the Promotion framework). I'm trying to load a view which is just a Google Maps view (GMSMapView) - their example even, it loads fine the first time the app is installed on a device or the simulator, but will without fail crash instantly every single time after that; or even if that screen is closed and then re-opened without closing the application.
The code is just Google's "Hello World" example, and I'm banging my head on the wall. My code is below, in addition to trying it as a Promotion Screen I've attempted this by subclassing a fresh UIViewController and get the same error.
My code:
class MapScreen < PM::Screen
def on_load
camera = GMSCameraPosition.cameraWithLatitude(-33.868, longitude: 151.2086, zoom: 6)
mapView = GMSMapView.mapWithFrame(CGRectZero, camera:camera)
marker = GMSMarker.new
marker.position = camera.target
marker.snippet = "Hello World"
marker.appearAnimation = 1
marker.map = mapView
mapView.delegate = self
# self.view = mapView
self.view.addSubview(mapView)
end
end
And here's the relevant parts of the crashlog:
Crashed Thread: 2 Dispatch queue: com.google.Maps.TileDataCacheQueue
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000656d69546e77
Thread 0:: Dispatch queue: NSPersistentStoreCoordinator 0x11c34be80
0 libobjc.A.dylib 0x000000010177302c objc_msgSend + 44
1 CoreData 0x00000001020e09d3 -[NSSQLModel _generateModel:error:] + 1363
2 CoreData 0x0000000101fc5481 -[NSSQLModel initWithManagedObjectModel:configurationName:retainHashHack:brokenHashVersion:] + 305
3 CoreData 0x0000000101fc4823 -[NSSQLCore initWithPersistentStoreCoordinator:configurationName:URL:options:] + 819
4 CoreData 0x00000001020ac77d __91-[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:]_block_invoke + 1069
5 CoreData 0x00000001020b9c30 gutsOfBlockToNSPersistentStoreCoordinatorPerform + 192
6 libdispatch.dylib 0x0000000106e50964 _dispatch_client_callout + 8
7 libdispatch.dylib 0x0000000106e39fca _dispatch_barrier_sync_f_invoke + 76
8 CoreData 0x00000001020ab245 _perform + 197
9 CoreData 0x0000000101fc42e1 -[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:] + 337
10 com.mwc.mwcpa2015 0x000000010002a341 -[GMSCacheStorage initWithName:modelBundle:modelName:directory:reset:] + 669
11 com.mwc.mwcpa2015 0x00000001001c3574 -[GMSServices initWithDisplayLink:resourceCache:] + 3617
12 com.mwc.mwcpa2015 0x00000001001c1d1f __43-[GMSAsyncInitServices sharedInitWithSync:]_block_invoke_2 + 105
13 com.mwc.mwcpa2015 0x00000001001c1c89 __43-[GMSAsyncInitServices sharedInitWithSync:]_block_invoke + 354
14 com.mwc.mwcpa2015 0x00000001001c1ae3 -[GMSAsyncInitServices sharedInitWithSync:] + 326
15 com.mwc.mwcpa2015 0x00000001001c191b -[GMSAsyncInitServices initSync] + 69
16 com.mwc.mwcpa2015 0x00000001001c25e0 +[GMSServices sharedServicesSync] + 183
17 com.mwc.mwcpa2015 0x00000001001b7814 -[GMSMapView sharedInitWithServices:camera:] + 162
18 com.mwc.mwcpa2015 0x00000001001b7112 -[GMSMapView initWithFrame:camera:] + 121
19 com.mwc.mwcpa2015 0x00000001001b6fb1 +[GMSMapView mapWithFrame:camera:] + 104
Thread 2 Crashed:: Dispatch queue: com.google.Maps.TileDataCacheQueue
0 libobjc.A.dylib 0x000000010175bcc1 class_getSuperclass + 11
1 com.mwc.mwcpa2015 0x00000001009e0af6 rb_objc_convert_immediate + 118
2 com.mwc.mwcpa2015 0x00000001002b14a9 vm_ocval_to_rval + 153
3 com.mwc.mwcpa2015 0x00000001002fee18 __unnamed_71 + 24
4 com.mwc.mwcpa2015 0x000000010003010e __47-[GMSTileDataCache startWithCompletionHandler:]_block_invoke57 + 639
5 com.mwc.mwcpa2015 0x000000010003496b -[GMSTileDataCache fetchTilesImmediateWithPredicate:sortDescriptor:completionHandler:] + 351
6 com.mwc.mwcpa2015 0x000000010002fd78 __47-[GMSTileDataCache startWithCompletionHandler:]_block_invoke + 412
7 libdispatch.dylib 0x0000000106e35f16 _dispatch_call_block_and_release + 12
8 libdispatch.dylib 0x0000000106e50964 _dispatch_client_callout + 8
9 libdispatch.dylib 0x0000000106e3acb4 _dispatch_queue_drain + 435
10 libdispatch.dylib 0x0000000106e3a9a3 _dispatch_queue_invoke + 217
11 libdispatch.dylib 0x0000000106e3cc85 _dispatch_root_queue_drain + 534
12 libdispatch.dylib 0x0000000106e3dd59 _dispatch_worker_thread3 + 98
13 libsystem_pthread.dylib 0x00000001071b9637 _pthread_wqthread + 729
14 libsystem_pthread.dylib 0x00000001071b740d start_wqthread + 13
This is driving me crazy, any help would be greatly appreciated!
Your marker is losing its reference and getting garbage collected. Try an ivar: