1

继续进入 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 0x07f30f8f 0x0 + 133369743 在 System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x00000] 在 /Developer/MonoTouch/Source/mono/mcs/类/corlib/System.Reflection/MonoMethod.cs:545 在 System.Activator.CreateInstance (System.Type,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo,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.IMvxTouchView1) 在 Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods/c__AnonStorey0 1.<>m__0 () <IL 0x00006, 0x00034> at Cirrious.MvvmCross.ExtensionMethods.MvxViewExtensionMethods.OnViewCreate<TViewModel> (Cirrious.MvvmCross.Interfaces.Views.IMvxView1,System.Func 1<TViewModel>) <IL 0x00012, 0x00045> at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods.OnViewCreate<TViewModel> (Cirrious.MvvmCross.Touch.Interfaces.IMvxTouchView1) 在 Cirrious.MvvmCross.Touch.Views.MvxTouchViewController`1.ViewDidLoad () 在 MyApp.UI.Touch.MainMenuViewController.ViewDidLoad () [ 0x00000] 在 /Users/franklyn/Documents/Programming/MyApp/MyApp.UI.Touch/Views/MainMenuViewController.cs:34

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

在(包装器运行时调用) object.runtime_invoke_void_ this_(对象,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] + 72 28 UIKit 0x00a63eab -[UINavigationController _startDeferredTransitionIfNeeded:] + 386 29 UIKit 0x00a63fc9 -[UINavigationController _startDeferredTransitionIfNeeded] + 41 30 UIKit 0x00a64055 -[UINavigationController] + 72 28 UIKit 0x00a63eab -[UINavigationController _startDeferredTransitionIfNeeded:] + 386 29 UIKit 0x00a63fc9 -[UINavigationController _startDeferredTransitionIfNeeded] + 41 30 UIKit 0x00a64055 -[UINavigationControllerviewWillLayoutSubviews] + 33 31 UIKit 0x00b693ab -[UILayoutContainerView layoutSubviews] + 233 32 UIKit 0x009ba92d -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 279 33 libobjc.A.dylib 0x022086b0 -[NSObject performSelector:withObject:] + 70 2f Qucz[0] + 70 2f Qucz[0]的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:持续时间:力:正在旋转:] + 5346 39 UIKit 0x009a0cbf -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82 40 UIKit 0x009a0bd9 -[UIWindow _setRotatableViewOrientation:duration:force:] + 89 41 UIKit 0x0099fe34 __57-[UIWindowforce:updateToInterfaceOrientation:: ] _block_invoke_0 + 224 42的UIKit 0x0099fc6e - [一个UIWindow _updateToInterfaceOrientation:持续时间:力:] + 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 0x009a3f65 atWindow makewrapperibleAndKeyVi65 -to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend (intptr,intptr) 在 MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00008] 在 /Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs: 126 在 MyApp.UI.Touch.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication,MonoTouch.Foundation.NSDictionary) [0x0003b] 在 /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/AppDelegate.cs :46 at (wrapper runtime-invoke) 。runtime_invoke_bool__this_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 0x01f34bf5CFRUNLOOP_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在(包装管理到本机) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) 在 MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] 在 /Developer/MonoTouch/Source/monotouch/src /UIKit/UIApplication.cs:38 在 /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/Main 中的 MyApp.UI.Touch.Application.Main (string[]) [0x00000]。CS:17中(封装器运行时调用).runtime_invoke_void_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 主要 + 2005 82 MyApp 0x000021f5 开始 + 53IntPtr的)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主+ 2005 82 MyApp的0x000021f5启动+ 53IntPtr的)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主+ 2005 82 MyApp的0x000021f5启动+ 53

2013-03-25 08:12:00.009 MyApp [7906:12203] 未处理的托管异常:调用目标已引发异常。(System.Reflection.TargetInvocationException) 在 System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] 参数, System.Globalization.CultureInfo 文化) [0x0011f] in / Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:536 在 System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] 参数, System .Globalization.CultureInfoculture) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:545 at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System .Reflection.Binder 活页夹,系统。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] (IMvxTouchView1 touchView) [0x00000] in :0 at 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] (IMvxView1 视图,System.Func1 viewModelLoader) [0x00000] in <filename unknown>:0 at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods.OnViewCreate[MainMenuViewModel] (IMvxTouchView1 touchView) [0x00000] in :0 at Cirrious.MvvmCross.Touch.Views.MvxTouchViewController`1[MyApp.Core.ViewModels.MainMenuViewModel].ViewDidLoad () [0x00000] in :0 at MyApp.UI.Touch.MainMenuViewController.ViewDidLoad () [0x00000] 在 /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/Views/MainMenuViewController.cs:34 处(包装器托管到本机) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend (intptr,intptr ) 在 MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00008] 在 MyApp.UI.Touch.AppDelegate.FinishedLaunching (MonoTouch.UIKit. UIApplication 应用程序,MonoTouch.Foundation.NSDictionary 选项)[0x0003b] in /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/AppDelegate.cs:46 at (wrapper managed-to-native) MonoTouch.UIKit .UIApplication: UIApplicationMain (int,string[],intptr,intptr) 在 MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] 在 /Developer/MonoTouch/Source /monotouch/src/UIKit/UIApplication.cs:38 在 /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch 中的 MyApp.UI.Touch.Application.Main (System.String[] args) [0x00000] /OtherClasses/Main.cs:17 堆栈跟踪:触摸/OtherClasses/Main.cs:17 堆栈跟踪:触摸/OtherClasses/Main.cs:17 堆栈跟踪:

本机堆栈跟踪:

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。这通常表示单声道运行时或本机库之一中的致命错误

由您的应用程序使用。

谢谢你的帮助。

4

1 回答 1

0

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

我猜在初始化地理观察器时存在一些问题 - 要么是因为:

  • 该插件未注册
  • 您在拨打此电话之前拨打此电话Cirrious.MvvmCross.Plugins.Location.PluginLoader.Instance.EnsureLoaded()
  • 或由于某些“应用程序特定原因”。

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

本教程对您有用吗?如果是这样,那么您可能需要比较两者。

如果崩溃对您来说仍然存在,那么也许: - 如果可以,发布内部异常?- 或发布一个演示问题的小型 repo - 我当然需要比我在这 2 行代码段中看到的更多的代码。


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

于 2013-03-22T13:02:35.080 回答