1

私は逆ジオコーディングを行うシンプルなクラスを持っていますが、アプリケーションがクラッシュすることがあります(SIGSEGV)、時には(50%)が一貫していません。MonoTouch:RequestReverseGeocodeクラッシュ

私は、UIスレッド、バックグラウンドスレッド、ViewControllerのライフサイクルのさまざまな部分で実行しようとしましたが、ランダムなようです。

at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain 
(int,string[],intptr,intptr) <IL 0x0009f, 0xffffffff> 
    at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00042] in 
/Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29 
    at MonoTouch.UIKit.UIApplication.Main (string[]) [0x00000] in 
/Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:34 
    at AlternativeFuelingStationLocator.Application.Main (string[]) [0x00000] in 
/Users/vink/Dropbox/Dev/iOS/UNIVERSAL/DOE/AlternativeFuelingStationLocator/AlternativeFuelingStationLocator/Main.cs:16 
    at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object 
(object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff> 

Native stacktrace: 

    0 AlternativeFuelingStationLocator 0x000e1018 
mono_handle_native_sigsegv + 408 
    1 AlternativeFuelingStationLocator 0x00011d9f 
mono_sigsegv_signal_handler + 351 
    2 libsystem_c.dylib     0x9ad7759b _sigtramp + 43 
    3 ???         0xffffffff 0x0 + 4294967295 
    4 MapKit        0x01e3b4cf MKMapRectRemainder + 
101422 
    5 GeoServices       0x0617f3b8 GEOTileKeyContainsKey + 
166198 
    6 GMM         0x092a3f3d 
GEOTileKeyFromGMMTilePath + 31777 
    7 ProtocolBuffer      0x061dfcf1 ProtocolBuffer + 19697 
    8 Foundation       0x0192aa59 
___NSURLConnectionDidFinishLoading_block_invoke_0 + 40 
    9 Foundation       0x01928e94 
__65-[NSURLConnectionInternal 
_withConnectionAndDelegate:onlyActive:]_block_invoke_0 + 40 
    10 Foundation       0x01929eb7 
-[NSURLConnectionInternalConnection invokeForDelegate:] + 39 
    11 Foundation       0x01928e4f 
-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 201 
    12 Foundation       0x01928fd5 
-[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 76 
    13 Foundation       0x0186df6a 
_NSURLConnectionDidFinishLoading + 43 
    14 CFNetwork       0x00c68bbd 
_ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE 
+ 241 
    15 CFNetwork       0x00d355ea 
_ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl 
+ 584 
    16 CFNetwork       0x00c5f298 
_ZN19URLConnectionClient13processEventsEv + 174 
    17 CFNetwork       0x00d3516b 
_ZThn52_N25URLConnectionInstanceData24multiplexerClientPerformEv + 21 
    18 CFNetwork       0x00c5f137 
_ZN17MultiplexerSource7performEv + 259 
    19 CoreFoundation      0x012ab97f 
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 
    20 CoreFoundation      0x0120eb73 __CFRunLoopDoSources0 + 
243 
    21 CoreFoundation      0x0120e454 __CFRunLoopRun + 1012 
    22 CoreFoundation      0x0120ddb4 CFRunLoopRunSpecific + 
212 
    23 CoreFoundation      0x0120dccb CFRunLoopRunInMode + 123 
    24 GraphicsServices     0x0489f879 GSEventRunModal + 207 
    25 GraphicsServices     0x0489f93e GSEventRun + 114 
    26 UIKit        0x022a6a9b UIApplicationMain + 1175 
    27 ???         0x0e0b6fcd 0x0 + 235630541 
    28 ???         0x0e0b6c18 0x0 + 235629592 
    29 ???         0x0e0b6184 0x0 + 235626884 
    30 ???         0x0e0b5fdc 0x0 + 235626460 
    31 ???         0x0e0b612e 0x0 + 235626798 
    32 AlternativeFuelingStationLocator 0x00011aef mono_jit_runtime_invoke 
+ 1407 
    33 AlternativeFuelingStationLocator 0x0022011a mono_runtime_invoke + 
170 
    34 AlternativeFuelingStationLocator 0x00222e51 mono_runtime_exec_main + 
705 
    35 AlternativeFuelingStationLocator 0x00222061 mono_runtime_run_main + 
929 
    36 AlternativeFuelingStationLocator 0x000ad6df mono_jit_exec + 239 
    37 AlternativeFuelingStationLocator 0x002f41ca main + 5194 
    38 AlternativeFuelingStationLocator 0x00003345 start + 53 


Got a SIGSEGV while executing native code. This usually indicates 
a fatal error in the mono runtime or one of the native libraries 
used by your application. 
+0

コードは正常です。しかし、クラッシュはiOSコードの中で深く、おそらくは利用できないものにアクセスしようとしています。これはスレッディング/ GCに関連する可能性があり、 'コールバック(callback) 'が非常に重要になります。より大きいテストケースが役に立ちます(bugzilla.xamarin.comに添付することができます) – poupou

+0

クラス変数への参照をすべて移動して、GCが収集されないようにしました。それはそれを修正したようです。ありがとう。 –

答えて

1

それはGCの問題(ガベージコレクションのようになります。あまりそれは主にちょうどMonoTouch.Dialog

MKReverseGeocoder coder; 
    MyMKReverseGeocoderDelegate myMKReverseGeocoderDelegate; 
    public void RequestReverseGeocode (CLLocationCoordinate2D coordinate, Action<MKPlacemark> callback) 
    { 
     myMKReverseGeocoderDelegate= new MyMKReverseGeocoderDelegate (callback); 
     coder = new MKReverseGeocoder (coordinate); 
     coder.Delegate = myMKReverseGeocoderDelegate; 
     coder.Start(); 
    } 

    internal class MyCLRequestLocationManagerDelegate : CLLocationManagerDelegate 
    { 
     Action<CLLocation> callback; 

     public MyCLRequestLocationManagerDelegate (Action<CLLocation> callback) 
     { 
      this.callback = callback; 
     } 

     public override void UpdatedLocation (CLLocationManager manager, CLLocation newLocation, CLLocation oldLocation) 
     { 
      manager.StopUpdatingLocation(); 
      locationManager = null; 
      callback (newLocation); 
     } 

     public override void Failed (CLLocationManager manager, NSError error) 
     { 
      callback (null); 
     } 
    } 

を経由してUIを構築し、起動時にクラッシュの詳細はここにあるアプリで何が起こっています)。

私が関与するすべてのオブジェクトを取り出してクラス変数にしたとき、問題はなくなりました。