- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在使用 Xamarin Forms,我只在第一代 iPad Mini (iOS 9.3.3 (13G34)) 上看到这个问题。
该应用程序启动正常,点击内容正常。唯一的问题发生在我“点击并按住”按钮时,导致它崩溃。
错误消息的重要部分可能是这样的:
+[NSTimer scheduledTimerWithTimeInterval:repeats:block:]: unrecognized selector sent to class 0x3b101ed4
未处理的异常:Foundation.MonoTouchException:
现在这个 [SO answer][1] 指出 NSTimer 是一个 iOS10+ API,因此 iOS9 不被支持。
我的问题是如何在 Xamarin Forms 环境中修复它?
谢谢。
完整的错误消息文本:
2018-10-18 14:31:25.805 MyApp.iOS[319:59406] +[NSTimer scheduledTimerWithTimeInterval:repeats:block:]: unrecognized selector sent to class 0x3b101ed4
Unhandled Exception:
Foundation.MonoTouchException: <Timeout exceeded getting exception details>
Thread finished: <Thread Pool> #10
The thread 0xa has exited with code 0 (0x0).
Thread finished: <Thread Pool> #13
The thread 0xd has exited with code 0 (0x0).
2018-10-18 14:31:47.340 MyApp.iOS[319:59406]
Unhandled Exception:
0 MyApp.iOS 0x05941e01 setup_stack_trace + 128
1 MyApp.iOS 0x0594017f mono_handle_exception_internal + 2026
2 MyApp.iOS 0x0593f991 mono_handle_exception + 50
3 MyApp.iOS 0x05937837 mono_arm_throw_exception + 118
4 MyApp.iOS 0x0085ac4c throw_exception + 64
5 MyApp.iOS 0x05a88390 xamarin_process_managed_exception_gchandle + 60
6 MyApp.iOS 0x05a8834c xamarin_ftnptr_exception_handler + 24
at (wrapper native-to-managed) ObjCRuntime.Runtime.throw_ns_exception (intptr) [0x00025] in <572357c3f84340a29e439dbdac7629bd#91B547D7-180F-9262-A1A8-072C01C70687>:0
8 MyApp.iOS 0x05a86228 xamarin_throw_ns_exception + 52
9 MyApp.iOS 0x05a892b4 _ZL17exception_handlerP11NSException + 288
10 CoreFoundation
0x24157c57 <redacted> + 642
11 libobjc.A.dylib 0x238f309f <redacted> + 174
12 libc++abi.dylib 0x238e4e17 <redacted> + 78
13 libc++abi.dylib 0x238e48f9 __cxa_increment_exception_refcount + 0
14 libobjc.A.dylib 0x238f2f5f objc_exception_rethrow + 42
15 CoreFoundation 0x240672af CFRunLoopRunSpecific + 654
16 CoreFoundation 0x24067015 CFRunLoopRunInMode + 108
17 GraphicsServices 0x25657ac9 GSEventRunModal + 160
18 UIKit 0x2873b189 UIApplicationMain + 144
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) [0x0004f] in <572357c3f84340a29e439dbdac7629bd#91B547D7-180F-9262-A1A8-072C01C70687>:0
at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00011] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:80
at UIKit.UIApplication
.Main (string[],string,string) [0x00034] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:64
at MyApp.iOS.Application.Main (string[]) [0x00001] in C:\Projects\MyProject\MyApp\MyApp.iOS\Main.cs:17
at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) [0x0001e] in <7d5a05cfcb09432d8cc656b9d781e54b#91B547D7-180F-9262-A1A8-072C01C70687>:0
24 MyApp.iOS 0x0594c9c9 mono_jit_runtime_invoke + 824
25 MyApp.iOS 0x059b6eef mono_runtime_invoke_checked + 102
26 MyApp.iOS 0x059bb6db mono_runtime_exec_main_checked + 66
27 MyApp.iOS 0x05934141 mono_jit_exec + 198
28 MyApp.iOS 0x05a9d174 xamarin_main + 2452
29 MyApp.iOS 0x002388bd main + 102
30 libdyld.dylib 0x23d0f873 <redacted> + 2
2018-10-18 14:31:47.344 MyApp.iOS[319:59406] Unhandled managed exception:
Objective-C exception thrown. Name: NSInvalidArgumentException Reason: +[NSTimer scheduledTimerWithTimeInterval:repeats:block:]: unrecognized selector sent to class 0x3b101ed4
Native stack trace:
0 CoreFoundation 0x24157933 <redacted> + 150
1 libobjc.A.dylib 0x238f2e17 objc_exception_throw + 38
2 CoreFoundation 0x2415d1d1 <redacted> + 0
3 CoreFoundation 0x2415aee1 <redacted> + 700
4 CoreFoundation 0x24086238 _CF_forwarding_prep_0 + 24
5 MyApp.iOS 0x02ae4e68 wrapper_managed_to_native_ObjCRuntime_Messaging_IntPtr_objc_msgSend_Double_bool_IntPtr_intptr_intptr_double_bool_intptr + 156
6 MyApp.iOS 0x025eb030 Foundation_NSTimer_CreateScheduledTimer_double_bool_System_Action_1_Foundation_NSTimer + 276
7 MyApp.iOS 0x058b39ec MyApp_Forms
_Controls_ExtendedButtonRenderer_OnLongPressed_UIKit_UILongPressGestureRecognizer + 1468
8 MyApp.iOS 0x0286d720 UIKit_UILongPressGestureRecognizer_Callback_Activated_UIKit_UILongPressGestureRecognizer + 52
9 MyApp.iOS 0x008014a4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 232
10 MyApp.iOS 0x0594c9c9 mono_jit_runtime_invoke + 824
11 MyApp.iOS 0x059b6eef mono_runtime_invoke_checked + 102
12 MyApp.iOS 0x059b9ac1 mono_runtime_invoke + 56
13 MyApp.iOS 0x001e7119 _ZL32native_to_managed_trampoline_212P11objc_objectP13objc_selectorPP11_MonoMethodP28UILongPressGestureRecognizerj + 326
14 MyApp.iOS 0x001e6fcf -[__UILongPressGestureRecognizer target:] + 50
15 UIKit 0x28c389eb <redacted> + 142
16 UIKit 0x2887384f <redacted> +
170
17 UIKit 0x28704ff1 <redacted> + 1004
18 UIKit 0x28c39d4f <redacted> + 62
19 UIKit 0x286c5a57 <redacted> + 298
20 UIKit 0x286c2017 <redacted> + 2902
21 CoreFoundation 0x241196c9 <redacted> + 20
22 CoreFoundation 0x241179cd <redacted> + 280
23 CoreFoundation 0x24117dff <redacted> + 958
24 CoreFoundation 0x24067229 CFRunLoopRunSpecific + 520
25 CoreFoundation 0x24067015 CFRunLoopRunInMode + 108
26 GraphicsServices 0x25657ac9 GSEventRunModal + 160
27 UIKit 0x2873b189 UIApplicationMain + 144
28 MyApp.iOS 0x02bc227c wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 288
29 MyApp.iOS 0x02412044 UIKit_UIApplication_Main_stri
ng___intptr_intptr + 52
30 MyApp.iOS 0x02411edc UIKit_UIApplication_Main_string___string_string + 200
31 MyApp.iOS 0x0023acb0 MyApp_iOS_Application_Main_string__ + 152
32 MyApp.iOS 0x008014a4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 232
33 MyApp.iOS 0x0594c9c9 mono_jit_runtime_invoke + 824
34 MyApp.iOS 0x059b6eef mono_runtime_invoke_checked + 102
35 MyApp.iOS 0x059bb6db mono_runtime_exec_main_checked + 66
36 MyApp.iOS 0x05934141 mono_jit_exec + 198
37 MyApp.iOS 0x05a9d174 xamarin_main + 2452
38 MyApp.iOS 0x002388bd main + 102
39 libdyld.dylib 0x23d0f873 <redacted> + 2
(Foundation.MonoTouchException)
at ObjCRuntime.Runtime.ThrowNSException (System.IntPtr ns_exception) [0x00000] in /Library/F
rameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:398
at ObjCRuntime.Runtime.throw_ns_exception (System.IntPtr exc) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/runtime/Delegates.generated.cs:126
at (wrapper native-to-managed) ObjCRuntime.Runtime.throw_ns_exception(intptr)
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:63
at MyApp.iOS.Application.Main (Syst
em.String[] args) [0x00001] in C:\Projects\MyProjects\MyApp\MyApp.iOS\Main.cs:17
2018-10-18 14:31:47.346 MyApp.iOS[319:59406] critical: Stacktrace:
2018-10-18 14:31:47.346 MyApp.iOS[319:59406] critical:
Native stacktrace:
2018-10-18 14:31:50.337 MyApp.iOS[319:59406] critical: 0 MyApp.iOS 0x05940dfd mono_handle_native_crash + 196
2018-10-18 14:31:50.338 MyApp.iOS[319:59406] critical: 1 libsystem_platform.dylib 0x23e86077 _sigtramp + 42
2018-10-18 14:31:50.338 MyApp.iOS[319:59406] critical: 2 libsystem_pthread.dylib 0x23e8c733 pthread_kill + 62
2018-10-18 14:31:50.339 MyApp.iOS[319:59406] critical: 3 libsystem_c.dylib 0x23d770ad abort + 108
2018-10-18 14:31:50.339 MyApp.iOS[319:59406] critical: 4 MyApp.iOS 0x05a888b4 xamarin_printf + 0
2018-10-18 14:31:50.339 MyApp.iOS[319:59406] critical: 5 MyApp.iOS 0x0597bf1f mono_invoke_unhandled_exception_hook + 102
2018-10-18 14:31:50.340 MyApp.iOS[319:59406] critical: 6 MyApp.iOS 0x0594083b mono_handle_exception_internal + 3750
2018-10-18 14:31:50.340 MyApp.iOS[319:59406] critical: 7 MyApp.iOS 0x0593f991 mono_handle_exception + 50
2018-10-18 14:31:50.341 MyApp.iOS[319:59406] critical: 8 MyApp.iOS 0x05937837 mono_arm_throw_exception + 118
2018-10-18 14:31:50.341 MyApp.iOS[319:59406] critical: 9 MyApp.iOS 0x0085ac4c throw_exception + 64
2018-10-18 14:31:50.341 MyApp.iOS[319:59406] critical: 10 MyApp.iOS 0x05a88390 xamarin_process_managed_exception_gchandle + 60
2018-10-18 14:31:50.342 MyApp.iOS[319:59406] critical: 11 MyApp.iOS 0x05a8834c xamarin_ftnptr_exception_handler + 24
2018-10-18 14:31:50.342 MyApp.iOS[319:59406] critical: 12 MyApp.iOS 0x02bd4f14 wrapper_native_to_managed_ObjCRuntime_Runtime_throw_ns_exception_intptr + 372
2018-10-18 14:31:50.342 MyApp.iOS[319:59406] critical: 13 MyApp.iOS 0x05a86228 xamarin_throw_ns_exception + 52
2018-10-18 14:31:50.343 MyApp.iOS[319:59406] critical: 14 MyApp.iOS 0x05a892b4 _ZL17exception_handlerP11NSException + 288
2018-10-18 14:31:50.344 MyApp.iOS[319:59406] critical: 15 CoreFoundation 0x24157c57 <redacted> + 642
2018-10-18 14:31:50.344 MyApp.iOS[319:59406] critical: 16 libobjc.A.dylib 0x238f309f <redacted> + 174
2018-10-18 14:31:50.344 MyApp.iOS[319:59406] critical: 17 libc++abi.dylib 0x238e4e17 <redacted> + 78
2018-10-18 14:31:50.345 MyApp.iOS[319:59406] critical: 18 libc++abi.dylib 0x238e48f9 __cxa_increment_exception_refcount + 0
2018-10-18 14:31:50.345 MyApp.iOS[319:59406] critical: 19 libobjc.A.dylib 0x238f2f5f objc_exception_rethrow + 42
2018-10-18 14:31:50.345 MyApp.iOS[319:59406] critical: 20 CoreFoundation 0x240672af CFRunLoopRunSpecific + 654
2018-10-18 14:31:50.346 MyApp.iOS[319:59406] critical: 21 CoreFoundation 0x24067015 CFRunLoopRunInMode + 108
2018-10-18 14:31:50.346 MyApp.iOS[319:59406] critical: 22 GraphicsServices 0x25657ac9 GSEventRunModal + 160
2018-10-18 14:31:50.347 MyApp.iOS[319:59406] critical: 23 UIKit 0x2873b189 UIApplicationMain + 144
2018-10-18 14:31:50.347 MyApp.iOS[319:59406] critical: 24 MyApp.iOS 0x02bc227c wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 288
2018-10-18 14:31:50.348 MyApp.iOS[319:59406] critical: 25 MyApp.iOS 0x02412044 UIKit_UIApplication_Main_string___intptr_intptr + 52
2018-10-18 14:31:50.348 MyApp.iOS[319:59406] critical: 26 MyApp.iOS 0x02411edc UIKit_UIApplication_Main_string___string_string + 200
2018-10-18 14:31:50.349 MyApp.iOS[319:59406] critical: 27 MyApp.iOS 0x0023acb0 MyApp_iOS_Application_Main_string__ + 152
2018-10-18 14:31:50.350 MyApp.iOS[319:59406] critical: 28 MyApp.iOS 0x008014a4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 232
2018-10-18 14:31:50.351 MyApp.iOS[319:59406] critical: 29 MyApp.iOS 0x0594c9c9 mono_jit_runtime_invoke + 824
2018-10-18 14:31:50.351 MyApp.iOS[319:59406] critical: 30 MyApp.iOS 0x059b6eef mono_runtime_invoke_checked + 102
2018-10-18 14:31:50.352 MyApp.iOS[319:59406] critical: 31 MyApp.iOS 0x059bb6db mono_runtime_exec_main_checked + 66
2018-10-18 14:31:50.352 MyApp.iOS[319:59406] critical: 32 MyApp.iOS 0x05934141 mono_jit_exec + 198
2018-10-18 14:31:50.352 MyApp.iOS[319:59406] critical: 33 MyApp.iOS 0x05a9d174 xamarin_main + 2452
2018-10-18 14:31:50.353 MyApp.iOS[319:59406] critical: 34 MyApp.iOS 0x002388bd main + 102
2018-10-18 14:31:50.353 MyApp.iOS[319:59406] critical: 35 libdyld.dylib 0x23d0f873 <redacted> + 2
2018-10-18 14:31:50.354 MyApp.iOS[319:59406] critical:
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
The app has been terminated.
Failed to Stop app: An error occured on client IDB4110776 while executing a reply for topic xvs/idb/4.11.0.776/stop-app
The app has been terminated.
[1]: https://stackoverflow.com/questions/40521799/trivial-nstimer-scheduledtimerwithtimeintervalrepeatsblock-unrecognized
最佳答案
可以使用方法
public static NSTimer CreateScheduledTimer (double seconds, NSObject target, Selector selector, NSObject userInfo, bool repeats)
For Example
//...
using ObjCRuntime;
//...
NSTimer.CreateScheduledTimer(0.5, this, new Selector("DelayAction"), null, false);
[Export("DelayAction")]
public void DelayAction()
{
// do some thing you want
}
关于ios - 未处理的异常 : Foundation. MonoTouchException:<超时获取异常详细信息>发生,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52883087/
下面的代码旨在在首次打开工作簿时运行。 Sub Auto_Open() Dim LastRow As Integer LastRow = Sheet6.UsedRange.Rows.Count Act
当我尝试操作我的代码时,除了弹出调试错误外,它执行得很好。错误信息在这里。 我的完整代码在这里。 #include using namespace std; class String { publi
The invocation of the constructor on type 'WpfApplication1.MainWindow' that matches the specified bi
我正在使用 BaseAdapter: public class MyAdapter extends BaseAdapter{ private final LayoutInflater mInflate
我想做网页抓取。我写了代码 var connection = require('./mysqlConnection'); var c = new Crawler({ maxConnections
我的系统中发生 Java 堆空间错误。我尝试了很多来自 Stack Overflow 的解决方案,但没有任何效果。当我工作时 当按下 OK 然后 (我的项目没有错误) 我的 eclipse.ini 是
环境: i5 750 DDR3 4GWin7 专业版 x64 sp1 DXSDK 9.0c 2010 年 6 月 GeForce GT240(驱动程序 275.33)512MB MSVC 2008 s
这段代码是我写的。 import socket host = 'localhost' port = 3794 s = socket.socket(socket.AF_INET, socket.SOCK
我正在尝试引用 UTC 时间间隔获取本地日期时间,我正在执行下面的代码。 var dtString =DateTime.UtcNow.ToString(@"yyyy-MM-ddTHH\:mm\:ss
我有一个非常简单的 C# 问题,它从库中加载 Windows WPF 窗口。这是代码: public partial class App : Application { public App(
我目前正在使用带有导航组件的底部导航,它工作正常但是当我们点击导航项 fragment 正在加载然后闪烁正在发生,即使当前选择的项目也会发生闪烁。它在加载 fragment 时发生。我的应用程序屏幕背
我是新来的 kotlin , 当我开始 Null Safety 时,我对下面的情况感到困惑. There's some data inconsistency with regard to initia
我有一个框,其中包含同时发生的两个独立的 css 转换。 当转换发生时,图标下方的标题和段落文本移动位置 参见 JS Fiddle:http://jsfiddle.net/Lsnbpt8r/ 这是我的
在为黑莓 10 构建电话间隙应用程序时,我遇到了异常情况。 [BUILD] Populating application source [BUILD] Parsing config.xml [
这个问题在这里已经有了答案: How to properly stop the Thread in Java? (8 个回答) 3年前关闭。 我看过How to properly stop the T
我试图弄清楚发生 fatal error 时如何刷新页面。基本上我正在访问图像 api 并将图像复制到我的服务器。我还每次都创建照片的缩略图版本。我会每隔一段时间收到一条错误消息,指出我的脚本试图分配
我正在尝试使用断言函数检查元素是否在屏幕上。我在我的测试应用程序 (AndroidDriver) 中使用 Appium 和 Java。我期望的是,如果元素在屏幕上,则返回 1;如果不在屏幕上,则返回
我正在开发图像上传系统。我使用 CommonsMultipartResolver 设置 maxUploadSize。当我尝试上传超过最大尺寸的图像文件时,会发生 MaxUploadSizeExcced
我有以下代码和@ComponentScan(basePackages = "com.project.shopping"),包结构为 com.project.shopping.Controller co
我尝试运行此程序作为测试,但收到错误“发生了 JNI 错误,请检查您的安装并重试”,然后是“发生了 Java 异常”。关于如何解决这个问题有什么想法吗? package java; public cl
我是一名优秀的程序员,十分优秀!