I have an application developed (renamed in my error as MyApplication for privacy) on the following enviroment:
Monotouch 2.1
MonoDevelop 2.4.2
MacOS 10.6.8
iOS SDK 4.3
that work fine.
Now i'm try to migrate to iOS 5.0/5.1 and Monotouch 5.2.5 with MonoDevelop 2.8.8.4.
My application crashes immediately with the following error:
Stacktrace:
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 MyApplication.Application.Main (string[]) [0x00000] in /Users/MyPC/Projects/Test/MyApplication/Main.cs:19
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
Native stacktrace:
0 MyApplication 0x000908fc mono_handle_native_sigsegv + 284
1 MyApplication 0x00005c98 mono_sigsegv_signal_handler + 248
2 libSystem.B.dylib 0x9138145b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 libobjc.A.dylib 0x02958753 prepareForMethodLookup + 93
5 libobjc.A.dylib 0x0294f069 lookUpMethod + 86
6 libobjc.A.dylib 0x0294f1d6 _class_lookupMethodAndLoadCache + 40
7 libobjc.A.dylib 0x029620e3 objc_msgSend + 87
8 UIKit 0x01cba799 -[UIControl sendAction:to:forEvent:] + 67
9 UIKit 0x01cbcc2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
10 UIKit 0x01cbba1c -[UIControl touchesBegan:withEvent:] + 277
11 UIKit 0x01c4ed41 -[UIWindow _sendTouchesForEvent:] + 395
12 UIKit 0x01c2fc37 -[UIApplication sendEvent:] + 447
13 UIKit 0x01c34f2e _UIApplicationHandleEvent + 7576
14 GraphicsServices 0x03fa5992 PurpleEventCallback + 1550
15 CoreFoundation 0x00df8944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16 CoreFoundation 0x00d58cf7 __CFRunLoopDoSource1 + 215
17 CoreFoundation 0x00d55f83 __CFRunLoopRun + 979
18 CoreFoundation 0x00d55840 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x00d55761 CFRunLoopRunInMode + 97
20 GraphicsServices 0x03fa41c4 GSEventRunModal + 217
21 GraphicsServices 0x03fa4289 GSEventRun + 115
22 UIKit 0x01c38c93 UIApplicationMain + 1160
23 ??? 0x090a61fc 0x0 + 151675388
24 ??? 0x090a60c8 0x0 + 151675080
25 ??? 0x090a59c0 0x0 + 151673280
26 ??? 0x090a590c 0x0 + 151673100
27 ??? 0x090a5997 0x0 + 151673239
28 MyApplication 0x0000a002 mono_jit_runtime_invoke + 722
29 MyApplication 0x00169efe mono_runtime_invoke + 126
30 MyApplication 0x0016dfe4 mono_runtime_exec_main + 420
31 MyApplication 0x00173405 mono_runtime_run_main + 725
32 MyApplication 0x00067205 mono_jit_exec + 149
33 MyApplication 0x002116d5 main + 2837
34 MyApplication 0x00003055 start + 53
35 ??? 0x00000004 0x0 + 4
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.
It is the same if i deploy it to iOS SDK 4.3. I'm thinking it might be a problem with the new GC SGen as mentioned here http://www.infoq.com/news/2012/02/MonoTouch-SGen
UPDATE: In fact error is showed on a Alert show as lv.Message = "Copy...";
Class Handle: the requested operation cannot be completed because the
object has been garbage collected
How could i solve it?
In MonoTouch 4 the GC is executed more aggressively to catch as early as possible a certain type of programming errors: ensuring that native objects aren't freed to early by the GC.
The most common pattern is to declare variables in a method:
void Method ()
{
var view = new UIView ();
otherNativeObject.NativeProperty = view;
}
What happens here is that the managed GC does not see that the otherNativeObject has a reference to the view, so when the method finishes executing, the GC will free the view. At a later point otherNativeObject will try to use the view, and you will end up with a crash similar to the one you reported (the exact stack trace and messages will vary a bit depending on where the freed native object is accessed).
The fix for the above example is easy, just make the view a class variable:
UIView view;
void Method ()
{
view = new UIView ();
otherNativeObject.NativeProperty = view;
}
now the GC will not be able to free the view when the method exits.
Note that this crash isn't new in MonoTouch 4, the effect of making the GC more aggressive is that you'll see the problem when debugging, as opposed to hearing it from your clients when they (very randomly) crash.
Related
In my app,push to a view controller contains wkwebview and use long press gesture to show the select text menu,then pop the view controller make web view to dealloc.And then push to another web view controller,send a gesture to webview,then crashed.It's occurd on iOS 14 beta 2.I have report the bug to apple.It's exist some way workround?
Date/Time: 2020-07-13 18:46:00.715 +0800
OS Version: Mac OS X 10.15.5 (19F101)
Report Version: 12
Bridge OS Version: 4.5 (17P5300)
Anonymous UUID: DC589A65-FAD9-1105-69E1-F841F6FEE2E3
Sleep/Wake UUID: D3E2CB0D-6218-4CC0-85C5-86C8DAE0B4BC
Time Awake Since Boot: 240000 seconds
Time Since Wake: 33000 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000022
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [50050]
VM Regions Near 0x22:
-->
__TEXT 000000010f792000-000000010f796000 [ 16K] r-x/r-x SM=COW /Users/USER/Library/Developer/CoreSimulator/Devices/4CDD359F-0A7E-4E13-A2CE-0DA825D90269/data/Containers/Bundle/Application/D19A53D4-CA61-4FCA-9F2D-ECAEA1A0D9C3/TestWebView.app/TestWebView
Application Specific Information:
CoreSimulator 725.10 - Device: iPhone 8 (4CDD359F-0A7E-4E13-A2CE-0DA825D90269) - Runtime: iOS 14.0 (18A5319g) - DeviceType: iPhone 8
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x0000000110d38b88 objc_retain + 8
1 com.apple.UIKitCore 0x00000001219ec716 -[UIInputResponderController prepareToMoveKeyboardForInputViewSet:animationStyle:] + 348
2 com.apple.UIKitCore 0x00000001219eacdf -[UIInputResponderController setKeyWindowSceneInputViews:animationStyle:] + 623
3 com.apple.UIKitCore 0x00000001219eaa45 -[UIInputResponderController setInputViews:animationStyle:] + 200
4 com.apple.UIKitCore 0x00000001219ec000 -[UIInputResponderController setInputViews:animated:] + 88
5 com.apple.UIKitCore 0x00000001219ec067 -[UIInputResponderController setInputViews:] + 68
6 com.apple.UIKitCore 0x00000001219e98a9 __74-[UIInputResponderController _reloadInputViewsForKeyWindowSceneResponder:]_block_invoke.605 + 30
7 com.apple.UIKitCore 0x00000001219e94b2 -[UIInputResponderController _reloadInputViewsForKeyWindowSceneResponder:] + 3982
8 com.apple.UIKitCore 0x00000001219e8507 -[UIInputResponderController _reloadInputViewsForResponder:] + 148
9 com.apple.UIKitCore 0x0000000121fdb741 -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 133
10 com.apple.UIKitCore 0x0000000121fd6af9 -[UIResponder becomeFirstResponder] + 806
11 com.apple.UIKitCore 0x00000001224df189 -[UIView(Hierarchy) becomeFirstResponder] + 145
12 com.apple.WebKit 0x000000010fed7f9c -[WKContentView(WKInteraction) becomeFirstResponderForWebView] + 136
13 com.apple.WebKit 0x000000010fac30c8 -[WKWebView(WKViewInternalIOS) becomeFirstResponder] + 133
14 com.apple.UIKitCore 0x00000001222870b7 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) setFirstResponderIfNecessaryActivatingSelection:] + 195
15 com.apple.UIKitCore 0x00000001222881e7 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) checkEditabilityAndSetFirstResponderIfNecessary] + 376
16 com.apple.UIKitCore 0x0000000122257e63 -[UITextIndirectNonEditableInteraction willBeginGesture] + 128
17 com.apple.UIKitCore 0x0000000121e16573 -[_UIKeyboardBasedNonEditableTextSelectionInteraction oneFingerForcePan:] + 1339
18 com.apple.UIKitCore 0x0000000121aed683 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 49
19 com.apple.UIKitCore 0x0000000121af7904 _UIGestureRecognizerSendTargetActions + 100
20 com.apple.UIKitCore 0x0000000121af41cb _UIGestureRecognizerSendActions + 294
21 com.apple.UIKitCore 0x0000000121af352a -[UIGestureRecognizer _updateGestureForActiveEvents] + 725
22 com.apple.UIKitCore 0x0000000121ae5a72 _UIGestureEnvironmentUpdate + 2652
23 com.apple.CoreFoundation 0x0000000110dfc277 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
24 com.apple.CoreFoundation 0x0000000110df6dae __CFRunLoopDoObservers + 487
25 com.apple.CoreFoundation 0x0000000110df72df __CFRunLoopRun + 1137
26 com.apple.CoreFoundation 0x0000000110df6aba CFRunLoopRunSpecific + 538
27 com.apple.GraphicsServices 0x00000001139fcdb3 GSEventRunModal + 139
28 com.apple.UIKitCore 0x0000000121fa27fe -[UIApplication _run] + 912
29 com.apple.UIKitCore 0x0000000121fa7e1e UIApplicationMain + 1570
30 jkl.TestWebView 0x000000010f793fa2 main + 114 (main.m:17)
31 libdyld.dylib 0x0000000119d4395d start + 1
Thread 1:
I met the same problem.
It seems -[UIInputViewSet restorableResponder] returns a wild pointer. This property is neither weak nor strong.
I added a symbol breakpoint to -[UIInputViewSet restorableResponder] and -[UIInputViewSet setRestorableResponder:], the assembly code shows they have neither store_weak nor store_strong code.
I used a workaround, hook -[UIInputViewSet restorableResponder] and return nil. Maybe it will cause another problem. But after testing it seems work well.
I have been getting crash reports like this for a keyboard extension I have developed and am either confused about how to read the stack trace or why it is occurring or both and I was hoping someone could help me clear this up.
Below is the stack trace:
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0xd15db9df
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x37949f66 objc_msgSend + 5
1 UIKit 0x2cd57f05 -[_UIViewControllerTransitionContext completeTransition:] + 52
2 UIKit 0x2d10ac1f __95-[_UIWindowAnimationController _performLayoutAnimationWithContext:windowGeometryUpdatingBlock:]_block_invoke88 + 26
3 UIKit 0x2cc7b8e1 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 308
4 UIKit 0x2cc7b4f9 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 184
5 UIKit 0x2cc7b40f -[UIViewAnimationState animationDidStop:finished:] + 70
6 QuartzCore 0x2c660fe7 CA::Layer::run_animation_callbacks(void*) + 234
7 libdispatch.dylib 0x37ecdc6f _dispatch_client_callout + 22
8 libdispatch.dylib 0x37ed9553 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1322
9 CoreFoundation 0x295ac889 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
10 CoreFoundation 0x295aafa9 __CFRunLoopRun + 1512
11 CoreFoundation 0x294f69a1 CFRunLoopRunSpecific + 476
12 CoreFoundation 0x294f67b3 CFRunLoopRunInMode + 106
13 GraphicsServices 0x30e911a9 GSEventRunModal + 136
14 UIKit 0x2cca7635 UIApplicationMain + 1440
15 libxpc.dylib 0x3806f9e3 _xpc_objc_main + 706
16 libxpc.dylib 0x38071009 xpc_main + 168
17 Foundation 0x2a3ec289 service_connection_handler + 162
18 PlugInKit 0x32c5ff75 -[PKService run] + 508
19 PlugInKit 0x32c5fc4b +[PKService main] + 58
20 PlugInKit 0x32c5ffa9 +[PKService _defaultRun:arguments:] + 20
21 libextension.dylib 0x371b60c5 NSExtensionMain + 48
22 libdyld.dylib 0x37f0baaf start + 2
In the left column where it lists the libraries (correct term?) I don't see any reference to my code. In other crash logs there is always some reference to a class in my app or something but I don't see that in this one. What does that mean? Is the crash occurring before my code executes and this is an Apple issue I can ignore?
It's an Apple Bug. The keyboard extension I work on has a nearly identical crash report. Fortunately, this only seems to happen on iOS 8, though I have seen a similar one that affects iOS 9.
I would file a bug report with Apple, and include a copy of the stack trace.
I am getting occasional SIGSEGV errors like below in my app (c# Xamarin iOS app with latest version of Xamarin Studio=5.8.3, Xamarin.iOS=8.9.1.3
It looks like in crashed in UIKit and from my own app "ObymobiMobileAppiOS" it's just in "main".
What kind of problem it is?
How can I get more info or debug it?
I can reproduce it by using the app for about 5 mins.
Stacktrace:
at <unknown> <0xffffffff>
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0xffffffff>
at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
at UIKit.UIApplication.Main (string[],string,string) [0x0001c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:45
at Obymobi.Mobile.App.iOS.Application.Main (string[]) [0x000b9] in /Users/billbatchelor/Documents/Mobile Development/AllInOne/Obymobi.Xamarin/Obymobi.Mobile.App.iOS/Main.cs:52
at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
Native stacktrace:
0 ObymobiMobileAppiOS 0x00000001024ef9ac mono_handle_native_sigsegv + 264
1 ObymobiMobileAppiOS 0x00000001024f97cc mono_sigsegv_signal_handler + 316
2 libsystem_platform.dylib 0x000000019890895c _sigtramp + 68
3 UIKit 0x000000018b535540 <redacted> + 216
4 UIKit 0x000000018b535030 <redacted> + 452
5 UIKit 0x000000018b534e38 <redacted> + 216
6 UIKit 0x000000018b534d4c <redacted> + 468
7 UIKit 0x000000018b48fd8c <redacted> + 264
8 UIKit 0x000000018b32ca2c <redacted> + 700
9 UIKit 0x000000018b325f68 <redacted> + 684
10 UIKit 0x000000018b2f918c <redacted> + 264
11 UIKit 0x000000018b59a324 <redacted> + 15424
12 UIKit 0x000000018b2f76a0 <redacted> + 1716
13 CoreFoundation 0x0000000186870240 <redacted> + 24
14 CoreFoundation 0x000000018686f4e4 <redacted> + 264
15 CoreFoundation 0x000000018686d594 <redacted> + 712
16 CoreFoundation 0x00000001867992d4 CFRunLoopRunSpecific + 396
17 GraphicsServices 0x000000018ffaf6fc GSEventRunModal + 168
18 UIKit 0x000000018b35efac UIApplicationMain + 1488
19 ObymobiMobileAppiOS 0x0000000100b61f28 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 344
20 ObymobiMobileAppiOS 0x00000001005387c0 UIKit_UIApplication_Main_string___intptr_intptr + 48
21 ObymobiMobileAppiOS 0x000000010053865c UIKit_UIApplication_Main_string___string_string + 188
22 ObymobiMobileAppiOS 0x000000010009c654 Obymobi_Mobile_App_iOS_Application_Main_string__ + 1508
23 ObymobiMobileAppiOS 0x0000000101007130 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 160
24 ObymobiMobileAppiOS 0x00000001024fb88c mono_jit_runtime_invoke + 1260
25 ObymobiMobileAppiOS 0x00000001025511e0 mono_runtime_invoke + 128
26 ObymobiMobileAppiOS 0x00000001025553c4 mono_runtime_exec_main + 404
27 ObymobiMobileAppiOS 0x00000001025c6a50 xamarin_main + 1812
28 ObymobiMobileAppiOS 0x00000001024b9688 main + 96
29 libdyld.dylib 0x000000019875aa08 <redacted> + 4
=================================================================
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.
Update
Here is another example of SIGSEGVs I get (this was on simulator) which doesn't have "redacted":-
Any more ideas how to find the problem? Or is it a possible bug in Xamarin?
Native stacktrace:
0 ObymobiMobileAppiOS 0x0011d4f7 mono_handle_native_sigsegv + 311
1 ObymobiMobileAppiOS 0x0014c505 mono_sigsegv_signal_handler + 213
2 libsystem_platform.dylib 0x08c8003b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 VectorKit 0x10663fe9 -[VKTileProvider tileSource:didFetchTile:forKey:] + 105
5 VectorKit 0x1067140e -[VKTileSource fetchedTile:forKey:] + 62
6 VectorKit 0x106c2617 -[VKTileSetBackedTileSource fetchedTile:forKey:] + 247
7 VectorKit 0x106705b5 -[VKTileSource _fetchedTile:] + 309
8 VectorKit 0x10671985 __49-[VKTileSource decodeData:downloadKey:sourceKey:]_block_invoke_2 + 181
9 libdispatch.dylib 0x08930d8a _dispatch_call_block_and_release + 15
10 libdispatch.dylib 0x0894decf _dispatch_client_callout + 14
11 libdispatch.dylib 0x0893602e _dispatch_queue_drain + 411
12 libdispatch.dylib 0x08935d33 _dispatch_queue_invoke + 197
13 libdispatch.dylib 0x0893820b _dispatch_root_queue_drain + 428
14 libdispatch.dylib 0x089393e7 _dispatch_worker_thread3 + 108
15 libsystem_pthread.dylib 0x08c8d1da _pthread_wqthread + 724
16 libsystem_pthread.dylib 0x08c8ae2e start_wqthread + 30
I came across the same problem. In my case I found some solutions:
If project referenced to wrapper above native library. Check that wrapper and your project have the same architecture - Classic API or Unified API.
1.1 Try to rebuild native project.
1.2 Remove project wrapper from solution and add reference only to output library.
Sometimes, native object are destroyed earlier than .NET. In this case, .NET object have exceptions inside and this error cannot catch with try-catch.
Need to dispose objects correctly.
Try to look crash report inside xcode to get more detailed information.
I faced this problem while using UIDocumentInteractionController. I was using instance of this class as a local parameter and garbage collector was flushing that instance even before the function execution completes. Taking that instance to Global scope solved my problem.
Are the version of Xamarin equal on OS X and Windows? I had similar error. When I updated Xamarin, everything was fine.
Recently I am trying to debug with the information provided by Crash Reports. So far I have been able to identify and fix some bugs but not this one.
As I read from the crash report, it's something wrong with UIDictationController, but my code did not call UIDictationController at all. The crash report is generated by PLCrashReporter.
It seems that the user is using an iPad Mini (WiFi) and running iOS 6.0.2.
Incident Identifier: [REMOVED]
CrashReporter Key: [REMOVED]
Hardware Model: iPad2,5
Process: MyApp [2849]
Path: [REMOVED]
Identifier: com.yourcompany.MyApp
Version: 1.1
Code Type: ARM
Parent Process: launchd [1]
Date/Time: 2013-01-26 02:11:01 +0000
OS Version: iPhone OS 6.0.2 (10A550)
Report Version: 104
Exception Type: SIGABRT
Exception Codes: #0 at 0x32255350
Crashed Thread: 0
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
Last Exception Backtrace:
0 CoreFoundation 0x3882e2a3 __exceptionPreprocess + 163
1 libobjc.A.dylib 0x30d8897f objc_exception_throw + 31
2 CoreFoundation 0x387788d9 -[__NSArrayM insertObject:atIndex:] + 769
3 UIKit 0x36ad24c3 -[UIDictationMeterView initWithFrame:] + 267
4 UIKit 0x36abe699 -[UIDictationView initWithFrame:] + 281
5 UIKit 0x36abdcd1 +[UIDictationView sharedInstance] + 145
6 UIKit 0x36aae7f5 -[UIDictationController setState:] + 149
7 UIKit 0x36aaef5f -[UIDictationController setupForDictationStart] + 199
8 UIKit 0x36aae5d7 -[UIDictationController startConnectionForReason:] + 51
9 UIKit 0x36aaf173 -[UIDictationController startDictationFromLayout] + 55
10 UIKit 0x36825c09 -[UIKeyboardLayoutStar touchUp:] + 5249
11 UIKit 0x3682472f -[UIKeyboardLayout touchesEnded:withEvent:] + 387
12 UIKit 0x3670c5f1 -[UIWindow _sendTouchesForEvent:] + 525
13 UIKit 0x366f9801 -[UIApplication sendEvent:] + 381
14 UIKit 0x366f911b _UIApplicationHandleEvent + 6155
15 GraphicsServices 0x3771e5a3 _PurpleEventCallback + 591
16 GraphicsServices 0x3771e1d3 PurpleEventCallback + 35
17 CoreFoundation 0x38803173 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 35
18 CoreFoundation 0x38803117 __CFRunLoopDoSource1 + 139
19 CoreFoundation 0x38801f99 __CFRunLoopRun + 1385
20 CoreFoundation 0x38774ebd CFRunLoopRunSpecific + 357
21 CoreFoundation 0x38774d49 CFRunLoopRunInMode + 105
22 GraphicsServices 0x3771d2eb GSEventRunModal + 75
23 UIKit 0x3674d2f9 UIApplicationMain + 1121
24 MyApp 0x000032e1 main (main.m:36)
25 MyApp 0x00003230 start + 40
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x30f10350 __pthread_kill + 8
1 libsystem_c.dylib 0x304f8973 abort + 95
2 MyApp 0x000e954f uncaught_exception_handler + 27
3 CoreFoundation 0x3882e57f __handleUncaughtException + 615
4 libobjc.A.dylib 0x30d88a65 _objc_terminate() + 129
5 libc++abi.dylib 0x3719807b safe_handler_caller(void (*)()) + 79
6 libc++abi.dylib 0x37198114 std::terminate() + 20
7 libc++abi.dylib 0x37199599 __cxa_current_exception_type + 1
8 libobjc.A.dylib 0x30d889d1 objc_exception_rethrow + 13
9 CoreFoundation 0x38774f21 CFRunLoopRunSpecific + 457
10 CoreFoundation 0x38774d49 CFRunLoopRunInMode + 105
11 GraphicsServices 0x3771d2eb GSEventRunModal + 75
12 UIKit 0x3674d2f9 UIApplicationMain + 1121
13 MyApp 0x000032e1 main (main.m:36)
Is there any way that I can do with this bug? Or, at least mitigating the issue? Thanks in advance.
the problem is that somewhere in your app you have a keyboard come up and with iOS version 6.0.1 and 6.0.2, apple enabled the dictation controller even if you didn't specify it to be enabled. Two solutions to fixing it: create a custom keyboard without it or implement dictation in your app.
My suggestion is to just let it be, only affects two outdate iOS versions and hopefully the crashes will go away as the users upgrade their devices
I have the keyboard coming up for a custom TextView, and when the user pushed the dictation button, said something, pushed finish, and then they tried to dismiss the keyboard, there would be a crash. Possible this is also what you're experiencing?
Building against MT 6.0.4.
Targeting iOS 4.
Testing on an iPhone 4S.
I'm stumped as to what I am doing wrong. I display the ABPeoplePickerNavigationController modally after subscribing to the SelectPerson event. Within the event, I take a copy of the data I need (only holding references to strings, not to any of the AdressBook or Person instances), and then close the modal dialog:
private string selectedPersonFirstName;
private string selectedPersonEmail;
private string selectedPersonPhone;
private void SelectContact()
{
var peoplePicker = new ABPeoplePickerNavigationController();
peoplePicker.Cancelled += (sender, e) =>
{
selectedPersonFirstName = null;
selectedPersonEmail = null;
selectedPersonPhone = null;
peoplePicker.DismissViewController(true, null);
};
peoplePicker.SelectPerson += (sender, e) =>
{
var selectedName = String.Format("{0} {1}", e.Person.FirstName, e.Person.LastName);
selectedPersonFirstName = e.Person.FirstName;
if ( e.Person.GetEmails().Count > 0)
selectedPersonEmail = e.Person.GetEmails().FirstOrDefault().Value;
if ( e.Person.GetPhones().Count > 0)
selectedPersonPhone = e.Person.GetPhones().FirstOrDefault().Value;
peoplePicker.DismissViewController(true, null);
};
PresentViewController(peoplePicker, true, null);
}
At some point later when the GC kicks in, it crashes:
Stacktrace:
at MonoTouch.Foundation.NSObject.FinishDispose () [0x0000b] in /Developer/MonoTouch/Source/monotouch/src/Foundation/NSObject.cs:158
at MonoTouch.Foundation.NSObject/MonoTouch_Disposer.Drain (MonoTouch.Foundation.NSObject) [0x00062] in /Developer/MonoTouch/Source/monotouch/src/Foundation/NSObject.cs:376
at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
at MyApp.iOS.Application.Main (string[]) [0x00000] in /Users/tyson/Code/MyApp/iOS/Main.cs:19
at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
Native stacktrace:
0 MyAppName--------------- 0x00f574f4 mono_handle_native_sigsegv + 280
1 MyAppName--------------- 0x00f3a2b8 mono_sigsegv_signal_handler + 268
2 libsystem_c.dylib 0x31ae97ed _sigtramp + 48
3 CoreFoundation 0x3745b2e7 CFRelease + 94
4 AddressBookUI 0x373922d1 -[ABGroupWrapper dealloc] + 100
5 libobjc.A.dylib 0x35a14175 _objc_rootRelease + 36
6 AddressBookUI 0x373a3f57 -[ABModel dealloc] + 146
7 libobjc.A.dylib 0x35a14175 _objc_rootRelease + 36
8 AddressBookUI 0x373aec43 -[ABAbstractViewController dealloc] + 38
9 AddressBookUI 0x373aeb3d -[ABMembersViewController dealloc] + 216
10 libobjc.A.dylib 0x35a14175 _objc_rootRelease + 36
11 CoreFoundation 0x3745b2e7 CFRelease + 94
12 CoreFoundation 0x3747106b -[__NSArrayM dealloc] + 122
13 libobjc.A.dylib 0x35a14175 _objc_rootRelease + 36
14 UIKit 0x33c891b9 -[UIViewController dealloc] + 496
15 UIKit 0x33c88f2f -[UINavigationController dealloc] + 198
16 AddressBookUI 0x373adcbd -[ABPeoplePickerNavigationController dealloc] + 376
17 libobjc.A.dylib 0x35a14175 _objc_rootRelease + 36
18 MyAppName--------------- 0x001e1ccc wrapper_managed_to_native_MonoTouch_ObjCRuntime_Messaging_void_objc_msgSend_intptr_intptr + 68
19 MyAppName--------------- 0x001ad49c MonoTouch_Foundation_NSObject_MonoTouch_Disposer_Drain_MonoTouch_Foundation_NSObject + 364
20 MyAppName--------------- 0x006997b8 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
21 MyAppName--------------- 0x00f3c6a4 mono_jit_runtime_invoke + 1644
22 MyAppName--------------- 0x00ff5dc0 mono_runtime_invoke + 128
23 MyAppName--------------- 0x00f2c6ec native_to_managed_trampoline_MonoTouch_Foundation_NSObject_MonoTouch_Disposer_Drain + 280
24 CoreFoundation 0x374a0eef +[NSObject performSelector:withObject:] + 42
25 Foundation 0x37d51747 __NSThreadPerformPerform + 350
26 CoreFoundation 0x374e6ad3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
27 CoreFoundation 0x374e629f __CFRunLoopDoSources0 + 214
28 CoreFoundation 0x374e5045 __CFRunLoopRun + 652
29 CoreFoundation 0x374684a5 CFRunLoopRunSpecific + 300
30 CoreFoundation 0x3746836d CFRunLoopRunInMode + 104
31 GraphicsServices 0x32375439 GSEventRunModal + 136
32 UIKit 0x33bece7d UIApplicationMain + 1080
33 MyAppName--------------- 0x001e6ca4 wrapper_managed_to_native_MonoTouch_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 240
34 MyAppName--------------- 0x00ee0210 MyApp_iOS_Application_Main_string__ + 152
35 MyAppName--------------- 0x006997b8 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
36 MyAppName--------------- 0x00f3c6a4 mono_jit_runtime_invoke + 1644
37 MyAppName--------------- 0x00ff5dc0 mono_runtime_invoke + 128
38 MyAppName--------------- 0x00ffa224 mono_runtime_exec_main + 436
39 MyAppName--------------- 0x00fff770 mono_runtime_run_main + 756
40 MyAppName--------------- 0x00f434a4 mono_jit_exec + 140
41 MyAppName--------------- 0x0105c04c main + 2028
42 MyAppName--------------- 0x0001bd18 start + 40
=================================================================
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.
=================================================================
Has anyone seen anything like this before? I'm up for workarounds at this point as I need it more reliable for a demo ASAP (not for app store submission yet).
It looks like a bug. Something gets released one time too many and crash.
You can, for your demonstration purpose, work around it by defining CFRetain like this:
[System.Runtime.InteropServices.DllImport ("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")]
static extern IntPtr CFRetain (IntPtr obj);
and use it on the _AddressBook, like that
peoplePicker.SelectPerson += (sender, e) => {
CFRetain (peoplePicker._AddressBook);
var selectedName = String.Format("{0} {1}", e.Person.FirstName, e.Person.LastName);
...
That will balance the count and avoid the crash.
Update: bug filled, you can c.c. yourself the the bug report to know when a fix will be released.