2

我有一個iOS應用程序內置RubyMotion(使用促銷框架)。我試圖加載一個僅僅是谷歌地圖視圖(GMSMapView)的視圖 - 它們的example even,它在應用程序第一次安裝在設備或模擬器上時加載的很好,但是在那之後的每一次都會立即崩潰;或者即使該屏幕已關閉,然後在未關閉應用程序的情況下重新打開。谷歌地圖在RubyMotion iOS SDK崩潰

的代碼僅僅是谷歌的「Hello World」的例子,我敲我的頭掛在牆上。我的代碼如下,除了嘗試它作爲促銷屏幕我試圖通過繼承一個新鮮的UIViewController並獲得相同的錯誤。

我的代碼:

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 

而這裏的系統崩潰日誌的相關部分:

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 

這是推動我瘋了,任何幫助,將不勝感激!

回答

0

你的標記失去其參考,並得到垃圾收集。嘗試一個伊娃:

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 
+0

謝謝,但不幸的是,它仍然給我在相同的位置相同的問題,在崩潰日誌相同的錯誤。 – TheVelourFog