MvvmCross vnext - 初始化IMvxGeoLocationWatcher问题

时间:2013-03-22 11:35:15

标签: xamarin.ios xamarin mvvmcross

继续前进到vnext ...

我现在可以构建整个解决方案&成功运行它。但是,当我尝试初始化IMvxGeoLocationWatcher时,它崩溃了。代码&输出是 -

private IMvxGeoLocationWatcher _geoWatcher;

public void StartGettingLocation(Action<MvxCoordinates> response)
{
    Log.Info("LocationService->StartGettingLocation");

    // crashes on this line -
    if (_geoWatcher == null) _geoWatcher = this.GetService<IMvxGeoLocationWatcher>();

输出 -

未处理的例外情况: 0 MyApp 0x000797ae mono_handle_exception_internal_first_pass + 2190 1 MyApp 0x0007b1e2 mono_handle_exception_internal + 1602 2 MyApp 0x0007bd2f mono_handle_exception + 47 3 MyApp 0x000bce22 mono_x86_throw_exception + 306 4 ??? 0x07f30f8f 0x0 + 133369743 在System.Reflection.MonoCMethod.Invoke(System.Reflection.BindingFlags,System.Reflection.Binder,object [],System.Globalization.CultureInfo)[0x00000] / Developer / MonoTouch / Source / mono / mcs / class / corlib /的System.Reflection / MonoMethod.cs:545 在/ Developer / MonoTouch / Source / mono /中的System.Activator.CreateInstance(System.Type,System.Reflection.BindingFlags,System.Reflection.Binder,object [],System.Globalization.CultureInfo,object [])[0x00174]中MCS /班/ corlib /系统/ Activator.cs:299 在/Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:234中的System.Activator.CreateInstance(System.Type,object [],object [])[0x00000] 在/Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:229中的System.Activator.CreateInstance(System.Type,object [])[0x00000]中 在Cirrious.MvvmCross.Application.MvxDefaultViewModelLocator.TryLoad(System.Type,System.Collections.Generic.IDictionary 2<string, string>,Cirrious.MvvmCross.Interfaces.ViewModels.IMvxViewModel&) <IL 0x00043, 0x000d8> at Cirrious.MvvmCross.Application.MvxViewModelLoader.LoadViewModel (Cirrious.MvvmCross.Views.MvxShowViewModelRequest) <IL 0x0005b, 0x000a2> at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods.LoadViewModel<TViewModel> (Cirrious.MvvmCross.Touch.Interfaces.IMvxTouchView 1) 在Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods / c__AnonStorey0 1.<>m__0 () <IL 0x00006, 0x00034> at Cirrious.MvvmCross.ExtensionMethods.MvxViewExtensionMethods.OnViewCreate<TViewModel> (Cirrious.MvvmCross.Interfaces.Views.IMvxView 1,System.Func 1<TViewModel>) <IL 0x00012, 0x00045> at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods.OnViewCreate<TViewModel> (Cirrious.MvvmCross.Touch.Interfaces.IMvxTouchView 1) 在Cirrious.MvvmCross.Touch.Views.MvxTouchViewController`1.ViewDidLoad() 在/Users/franklyn/Documents/Programming/MyApp/MyApp.UI.Touch/Views/MainMenuViewController.cs:34中的MyApp.UI.Touch.MainMenuViewController.ViewDidLoad()[0x00000]

编辑 - 异常跟踪的其余部分:

at(wrapper runtime-invoke)object.runtime_invoke_void_ this _(object,intptr,intptr,intptr) 18 MyApp 0x00008732 mono_jit_runtime_invoke + 722 19 MyApp 0x0014f39e mono_runtime_invoke + 126 20 MyApp 0x001e6296 monotouch_trampoline + 3686 21 UIKit 0x00a4b817 - [UIViewController loadViewIfRequired] + 536 22 UIKit 0x00a4b882 - [UIViewController视图] + 33 23 UIKit 0x00a4bb2a - [UIViewController contentScrollView] + 36 24 UIKit 0x00a62ef5 - [UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 36 25 UIKit 0x00a62fdb - [UINavigationController _layoutViewController:] + 43 26 UIKit 0x00a63286 - [UINavigationController _updateScrollViewFromViewController:toViewController:] + 254 27 UIKit 0x00a63381 - [UINavigationController _startTransition:fromViewController:toViewController:] + 72 28 UIKit 0x00a63eab - [UINavigationController _startDeferredTransitionIfNeeded:] + 386 29 UIKit 0x00a63fc9 - [UINavigationController _startDeferredTransitionIfNeeded] + 41 30 UIKit 0x00a64055 - [UINavigationController viewWillLayoutSubviews] + 33 31 UIKit 0x00b693ab - [UILayoutContainerView layoutSubviews] + 233 32 UIKit 0x009ba92d - [UIView(CALayerDelegate)layoutSublayersOfLayer:] + 279 33 libobjc.A.dylib 0x022086b0 - [NSObject performSelector:withObject:] + 70 34 QuartzCore 0x01952fc0 - [CALayer layoutSublayers] + 240 35 QuartzCore 0x0194733c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 468 36 QuartzCore 0x01952eaf - [CALayer layoutIfNeeded] + 166 37 UIKit 0x00a598cd - [UIViewController窗口:setupWithInterfaceOrientation:] + 242 38 UIKit 0x009a21a6 - [UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 5346 39 UIKit 0x009a0cbf - [UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82 40 UIKit 0x009a0bd9 - [UIWindow _setRotatableViewOrientation:duration:force:] + 89 41 UIKit 0x0099fe34 __57- [UIWindow _updateToInterfaceOrientation:duration:force:] _ block_invoke_0 + 224 42 UIKit 0x0099fc6e - [UIWindow _updateToInterfaceOrientation:duration:force:] + 209 43 UIKit 0x009a0a29 - [UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 853 44 UIKit 0x009a3922 - [UIWindow setDelegate:] + 351 45 UIKit 0x00a4dfec - [UIViewController _tryBecomeRootViewControllerInWindow:] + 164 46 UIKit 0x0099abc4 - [UIWindow addRootViewControllerViewIfPossible] + 481 47 UIKit 0x0099adbf - [UIWindow _setHidden:forced:] + 368 48 UIKit 0x0099af55 - [UIWindow _orderFrontWithoutMakingKey] + 49 49 UIKit 0x009a3f67 - [UIWindow makeKeyAndVisible] + 65 at(包装器托管到原生)MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend(intptr,intptr) 在/Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:126中的MonoTouch.UIKit.UIWindow.MakeKeyAndVisible()[0x00008] 在/Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/AppDelegate.cs中的MyApp.UI.Touch.AppDelegate.FinishedLaunching(MonoTouch.UIKit.UIApplication,MonoTouch.Foundation.NSDictionary)[0x0003b]: 46 at(wrapper runtime-invoke).runtime_invoke_bool__this _object_object(object,intptr,intptr,intptr) 54 MyApp 0x00008732 mono_jit_runtime_invoke + 722 55 MyApp 0x0014f39e mono_runtime_invoke + 126 56 MyApp 0x001e6296 monotouch_trampoline + 3686 57 UIKit 0x009677b7 - [UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 266 58 UIKit 0x00967da7 - [UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1248 59 UIKit 0x00968fab - [UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 805 60 UIKit 0x0097a315 - [UIApplication handleEvent:withNewEvent:] + 1022 61 UIKit 0x0097b24b - [UIApplication sendEvent:] + 85 62 UIKit 0x0096ccf8 _UIApplicationHandleEvent + 9874 63 GraphicsServices 0x02c98df9 _PurpleEventCallback + 339 64 GraphicsServices 0x02c98ad0 PurpleEventCallback + 46 65 CoreFoundation 0x01f34bf5 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 53 66 CoreFoundation 0x01f34962 __CFRunLoopDoSource1 + 146 67 CoreFoundation 0x01f65bb6 __CFRunLoopRun + 2118 68 CoreFoundation 0x01f64f44 CFRunLoopRunSpecific + 276 69 CoreFoundation 0x01f64e1b CFRunLoopRunInMode + 123 70 UIKit 0x009687da - [UIApplication _run] + 774 71 UIKit 0x0096a65c UIApplicationMain + 1211 at(包装器托管到原生)MonoTouch.UIKit.UIApplication.UIApplicationMain(int,string [],intptr,intptr) 在/Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38中的MonoTouch.UIKit.UIApplication.Main(string [],string,string)[0x0004c] 在/Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/Main.cs:17中的MyApp.UI.Touch.Application.Main(string [])[0x00000] at(wrapper runtime-invoke).runtime_invoke_void_object(object,intptr,intptr,intptr) 76 MyApp 0x00008732 mono_jit_runtime_invoke + 722 77 MyApp 0x0014f39e mono_runtime_invoke + 126 78 MyApp 0x001534c4 mono_runtime_exec_main + 420 79 MyApp 0x00157ff5 mono_runtime_run_main + 725 80 MyApp 0x000651a5 mono_jit_exec + 149 81 MyApp 0x001db7b5 main + 2005 82 MyApp 0x000021f5 start + 53

2013-03-25 08:12:00.009 MyApp [7906:12203]未处理的托管异常:调用目标抛出了异常。 (System.Reflection.TargetInvocationException)   at System.Reflection.MonoCMethod.Invoke(System.Object obj,BindingFlags invokeAttr,System.Reflection.Binder binder,System.Object [] parameters,System.Globalization.CultureInfo culture)[0x0011f] in / Developer / MonoTouch / Source / mono /mcs/class/corlib/System.Reflection/MonoMethod.cs:536   at System.Reflection.MonoCMethod.Invoke(BindingFlags invokeAttr,System.Reflection.Binder binder,System.Object [] parameters,System.Globalization.CultureInfo culture)[0x00000]在/ Developer / MonoTouch / Source / mono / mcs / class / corlib /的System.Reflection / MonoMethod.cs:545   在/ Developer /中的System.Activator.CreateInstance(System.Type类型,BindingFlags bindingAttr,System.Reflection.Binder binder,System.Object [] args,System.Globalization.CultureInfo culture,System.Object [] activationAttributes)[0x00174] MonoTouch的/来源/单声道/ MCS /班/ corlib /系统/ Activator.cs:299   在/Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs中的System.Activator.CreateInstance(System.Type类型,System.Object [] args,System.Object [] activationAttributes)[0x00000]中:234   在/Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:229中的System.Activator.CreateInstance(System.Type type,System.Object [] args)[0x00000]   在Cirrious.MvvmCross.Application.MvxDefaultViewModelLocator.TryLoad(System.Type viewModelType,IDictionary 2 parameterValueLookup, IMvxViewModel& model) [0x00000] in <filename unknown>:0 at Cirrious.MvvmCross.Application.MvxViewModelLoader.LoadViewModel (Cirrious.MvvmCross.Views.MvxShowViewModelRequest request) [0x00000] in <filename unknown>:0 at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods.LoadViewModel[MainMenuViewModel] (IMvxTouchView 1 touchView)[0x00000] in:0   在Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods + c__AnonStorey0 1[MyApp.Core.ViewModels.MainMenuViewModel].<>m__0 () [0x00000] in <filename unknown>:0 at Cirrious.MvvmCross.ExtensionMethods.MvxViewExtensionMethods.OnViewCreate[MainMenuViewModel] (IMvxView 1视图,System.Func 1 viewModelLoader) [0x00000] in <filename unknown>:0 at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods.OnViewCreate[MainMenuViewModel] (IMvxTouchView 1 touchView)[0x00000] in:0   在Cirrious.MvvmCross.Touch.Views.MvxTouchViewController`1 [MyApp.Core.ViewModels.MainMenuViewModel] .ViewDidLoad()[0x00000] in:0   在/Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/Views/MainMenuViewController.cs:34中的MyApp.UI.Touch.MainMenuViewController.ViewDidLoad()[0x00000]   at(包装器托管到原生)MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend(intptr,intptr)   在/Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:126中的MonoTouch.UIKit.UIWindow.MakeKeyAndVisible()[0x00008]   在/Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/AppDelegate中的MyApp.UI.Touch.AppDelegate.FinishedLaunching(MonoTouch.UIKit.UIApplication应用程序,MonoTouch.Foundation.NSDictionary选项)[0x0003b]。 CS:46   at(包装器托管到原生)MonoTouch.UIKit.UIApplication:UIApplicationMain(int,string [],intptr,intptr)   在/Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38中的MonoTouch.UIKit.UIApplication.Main(System.String [] args,System.String principalClassName,System.String delegateClassName)[0x0004c]   在/Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/Main.cs:17中的MyApp.UI.Touch.Application.Main(System.String [] args)[0x00000] 堆栈跟踪:

原生堆栈跟踪:

0   MyApp                      0x0007bf6c mono_handle_native_sigsegv + 284
1   MyApp                      0x000c01ad sigabrt_signal_handler + 109
2   libsystem_c.dylib                   0x9a5da59b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   libsystem_sim_c.dylib               0x0297457b abort + 140
5   MyApp                      0x001ed17b monotouch_unhandled_exception_handler + 283
6   MyApp                      0x00077dbc mono_invoke_unhandled_exception_hook + 140
7   MyApp                      0x0007bbda mono_handle_exception_internal + 4154
8   MyApp                      0x0007bd2f mono_handle_exception + 47
9   MyApp                      0x000bce22 mono_x86_throw_exception + 306
10  ???                                 0x07f30f8f 0x0 + 133369743
11  ???                                 0x0bad1a5d 0x0 + 195893853
12  ???                                 0x0bad13dd 0x0 + 195892189
13  ???                                 0x0bad1164 0x0 + 195891556
14  ???                                 0x0bad112c 0x0 + 195891500
15  ???                                 0x11b0a360 0x0 + 296788832
16  ???                                 0x11b09fca 0x0 + 296787914
17  ???                                 0x11b09de2 0x0 + 296787426
18  ???                                 0x11b09cf4 0x0 + 296787188
19  ???                                 0x11b09c65 0x0 + 296787045
20  ???                                 0x11b09b60 0x0 + 296786784
21  ???                                 0x11b09a5c 0x0 + 296786524
22  ???                                 0x11b099c4 0x0 + 296786372
23  ???                                 0x07fe2059 0x0 + 134094937
24  MyApp                      0x00008732 mono_jit_runtime_invoke + 722
25  MyApp                      0x0014f39e mono_runtime_invoke + 126
26  MyApp                      0x001e6296 monotouch_trampoline + 3686
27  UIKit                               0x00a4b817 -[UIViewController loadViewIfRequired] + 536
28  UIKit                               0x00a4b882 -[UIViewController view] + 33
29  UIKit                               0x00a4bb2a -[UIViewController contentScrollView] + 36
30  UIKit                               0x00a62ef5 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 36
31  UIKit                               0x00a62fdb -[UINavigationController _layoutViewController:] + 43
32  UIKit                               0x00a63286 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 254
33  UIKit                               0x00a63381 -[UINavigationController _startTransition:fromViewController:toViewController:] + 72
34  UIKit                               0x00a63eab -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
35  UIKit                               0x00a63fc9 -[UINavigationController _startDeferredTransitionIfNeeded] + 41
36  UIKit                               0x00a64055 -[UINavigationController __viewWillLayoutSubviews] + 33
37  UIKit                               0x00b693ab -[UILayoutContainerView layoutSubviews] + 233
38  UIKit                               0x009ba92d -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 279
39  libobjc.A.dylib                     0x022086b0 -[NSObject performSelector:withObject:] + 70
40  QuartzCore                          0x01952fc0 -[CALayer layoutSublayers] + 240
41  QuartzCore                          0x0194733c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 468
42  QuartzCore                          0x01952eaf -[CALayer layoutIfNeeded] + 166
43  UIKit                               0x00a598cd -[UIViewController window:setupWithInterfaceOrientation:] + 242
44  UIKit                               0x009a21a6 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 5346
45  UIKit                               0x009a0cbf -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
46  UIKit                               0x009a0bd9 -[UIWindow _setRotatableViewOrientation:duration:force:] + 89
47  UIKit                               0x0099fe34 __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke_0 + 224
48  UIKit                               0x0099fc6e -[UIWindow _updateToInterfaceOrientation:duration:force:] + 209
49  UIKit                               0x009a0a29 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 853
50  UIKit                               0x009a3922 -[UIWindow setDelegate:] + 351
51  UIKit                               0x00a4dfec -[UIViewController _tryBecomeRootViewControllerInWindow:] + 164
52  UIKit                               0x0099abc4 -[UIWindow addRootViewControllerViewIfPossible] + 481
53  UIKit                               0x0099adbf -[UIWindow _setHidden:forced:] + 368
54  UIKit                               0x0099af55 -[UIWindow _orderFrontWithoutMakingKey] + 49
55  UIKit                               0x009a3f67 -[UIWindow makeKeyAndVisible] + 65
56  ???                                 0x11aee564 0x0 + 296674660
57  ???                                 0x11b099a8 0x0 + 296786344
58  ???                                 0x0bad24ee 0x0 + 195896558
59  ???                                 0x0bad25df 0x0 + 195896799
60  MyApp                      0x00008732 mono_jit_runtime_invoke + 722
61  MyApp                      0x0014f39e mono_runtime_invoke + 126
62  MyApp                      0x001e6296 monotouch_trampoline + 3686
63  UIKit                               0x009677b7 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 266
64  UIKit                               0x00967da7 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1248
65  UIKit                               0x00968fab -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 805
66  UIKit                               0x0097a315 -[UIApplication handleEvent:withNewEvent:] + 1022
67  UIKit                               0x0097b24b -[UIApplication sendEvent:] + 85
68  UIKit                               0x0096ccf8 _UIApplicationHandleEvent + 9874
69  GraphicsServices                    0x02c98df9 _PurpleEventCallback + 339
70  GraphicsServices                    0x02c98ad0 PurpleEventCallback + 46
71  CoreFoundation                      0x01f34bf5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
72  CoreFoundation                      0x01f34962 __CFRunLoopDoSource1 + 146
73  CoreFoundation                      0x01f65bb6 __CFRunLoopRun + 2118
74  CoreFoundation                      0x01f64f44 CFRunLoopRunSpecific + 276
75  CoreFoundation                      0x01f64e1b CFRunLoopRunInMode + 123
76  UIKit                               0x009687da -[UIApplication _run] + 774
77  UIKit                               0x0096a65c UIApplicationMain + 1211
78  ???                                 0x0bacf84c 0x0 + 195885132
79  ???                                 0x0bace218 0x0 + 195879448
80  ???                                 0x0bacdfb0 0x0 + 195878832
81  ???                                 0x0bace03f 0x0 + 195878975
82  MyApp                      0x00008732 mono_jit_runtime_invoke + 722
83  MyApp                      0x0014f39e mono_runtime_invoke + 126
84  MyApp                      0x001534c4 mono_runtime_exec_main + 420
85  MyApp                      0x00157ff5 mono_runtime_run_main + 725
86  MyApp                      0x000651a5 mono_jit_exec + 149
87  MyApp                      0x001db7b5 main + 2005
88  MyApp                      0x000021f5 start + 53

=============================================== ================== 执行本机代码时获得SIGABRT。这通常表明 单声道运行时或其中一个本机库中的致命错误

由您的应用程序使用。

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

如果没有内部异常,很难知道出了什么问题 - 抱歉。

我猜测初始化geowatcher存在一些问题 - 要么是因为:

  • 插件未注册
  • 在拨打Cirrious.MvvmCross.Plugins.Location.PluginLoader.Instance.EnsureLoaded()
  • 之前,请拨打此线路
  • 或由于某些“应用特定原因”。

教程应用使用位置插件:https://github.com/slodge/MvvmCross/tree/vnext/Sample%20-%20Tutorial/Tutorial/Tutorial.UI.Touch

教程是否适合您?如果确实如此,那么你可能需要考虑比较两者。

如果崩溃仍然存在,那么可能: - 如果可以,发布内部异常? - 或者发布一个小型仓库来解决这个问题 - 我当然需要比我在这2行代码中看到的更多的代码。


很抱歉缺少文档。我现在正在努力为新发布的v3创建适当的文档和教程 - 但这都是自筹资金!