Bug 5883 - Access calendarIdentifier property of calendar object crashes the app
Summary: Access calendarIdentifier property of calendar object crashes the app
Status: RESOLVED FEATURE
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.3.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-06-27 05:54 UTC by Si Quy Lee
Modified: 2012-07-16 10:36 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FEATURE

Description Si Quy Lee 2012-06-27 05:54:02 UTC
Here is the stack trace

970-01-01 11:52:19.-722 Komfortmasken[335:307] -[EKCalendar calendarIdentifier]: unrecognized selector sent to instance 0xeae190

Unhandled Exception: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[EKCalendar calendarIdentifier]: unrecognized selector sent to instance 0xeae190
  at MonoTouch.EventKit.EKCalendar.get_CalendarIdentifier () [0x0000b] in /Developer/MonoTouch/Source/monotouch/src/EventKit/EKCalendar.g.cs:171 
  at Komfortmasken.Helpers.EventKitHelper.GetAllCalendars (MonoTouch.UIKit.UIViewController controller) [0x00043] in /Users/sutolym/Projects/Helpers/EventKitHelper.cs:51 
  at Komfortmasken.HomeNavigationController.ViewDidLoad () [0x00032] in /Users/sutolym/Projects/Controllers/HomeNavigationController.cs:32 
  at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x0000b] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:105 
  at Komfortmasken.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00053] in /Users/sutolym/Projects/AppDelegate.cs:41 
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29 
  at Komfortmasken.Application.Main (System.String[] args) [0x00000] in /Users/sutolym/Projects/Main.cs:16 
[ERROR] FATAL UNHANDLED EXCEPTION: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[EKCalendar calendarIdentifier]: unrecognized selector sent to instance 0xeae190
  at MonoTouch.EventKit.EKCalendar.get_CalendarIdentifier () [0x0000b] in /Developer/MonoTouch/Source/monotouch/src/EventKit/EKCalendar.g.cs:171 
  at Komfortmasken.Helpers.EventKitHelper.GetAllCalendars (MonoTouch.UIKit.UIViewController controller) [0x00043] in /Users/sutolym/Projects/Helpers/EventKitHelper.cs:51 
  at Komfortmasken.HomeNavigationController.ViewDidLoad () [0x00032] in /Users/sutolym/Projects/Controllers/HomeNavigationController.cs:32 
  at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x0000b] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:105 
  at Komfortmasken.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00053] in /Users/sutolym/Projects/AppDelegate.cs:41 
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29 
  at Komfortmasken.Application.Main (System.String[] args) [0x00000] in /Users/sutolym/Projects/Main.cs:16 
Terminating runtime due to unhandled exception
Stacktrace:


Native stacktrace:

	0   Komfortmasken                       0x005a0af0 mono_handle_native_sigsegv + 280
	1   Komfortmasken                       0x005c3844 sigabrt_signal_handler + 180
	2   libSystem.B.dylib                   0x32d24487 _sigtramp + 34
	3   libSystem.B.dylib                   0x32d25ac5 kill + 10
	4   libSystem.B.dylib                   0x32d25ab9 raise + 16
	5   libSystem.B.dylib                   0x32d3cd65 abort + 60
	6   Komfortmasken                       0x0067c9c0 monoeg_g_logv + 152
	7   Komfortmasken                       0x0067ca0c monoeg_assertion_message + 52
	8   Komfortmasken                       0x0058a4bc mono_thread_abort + 148
	9   Komfortmasken                       0x005a06bc mono_handle_exception_internal + 3188
	10  Komfortmasken                       0x005a08c0 mono_handle_exception + 24
	11  Komfortmasken                       0x005c2458 mono_arm_throw_exception + 172
	12  Komfortmasken                       0x0034124c throw_exception + 48
	13  Komfortmasken                       0x00697734 monotouch_exception_handler + 76
	14  CoreFoundation                      0x35f08db1 __handleUncaughtException + 212
	15  libobjc.A.dylib                     0x301888d4 _objc_terminate + 156
	16  libstdc++.6.dylib                   0x3582d108 _ZN10__cxxabiv111__terminateEPFvvE + 84
	17  libstdc++.6.dylib                   0x3582d180 _ZSt9terminatev + 24
	18  libstdc++.6.dylib                   0x3582d2a8 __cxa_throw + 108
	19  libobjc.A.dylib                     0x30186f30 objc_exception_throw + 112
	20  CoreFoundation                      0x35f0a3e3 -[NSObject(NSObject) doesNotRecognizeSelector:] + 98
	21  CoreFoundation                      0x35eaf467 ___forwarding___ + 506
	22  CoreFoundation                      0x35eaf220 _CF_forwarding_prep_0 + 48
	23  Komfortmasken                       0x0004751c wrapper_managed_to_native_MonoTouch_ObjCRuntime_Messaging_IntPtr_objc_msgSend_intptr_intptr + 68
	24  Komfortmasken                       0x0042ec00 Komfortmasken_Helpers_EventKitHelper_GetAllCalendars_MonoTouch_UIKit_UIViewController + 876
	25  Komfortmasken                       0x00433d0c Komfortmasken_HomeNavigationController_ViewDidLoad + 456
	26  Komfortmasken                       0x0030ddd8 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
	27  Komfortmasken                       0x0058d130 mono_jit_runtime_invoke + 1644
	28  Komfortmasken                       0x006355bc mono_runtime_invoke + 128
	29  Komfortmasken                       0x00691d3c monotouch_trampoline + 3196
	30  UIKit                               0x3386ee60 -[UIViewController view] + 160
	31  UIKit                               0x33890fb4 -[UIViewController nextResponder] + 20
	32  UIKit                               0x3384e5f4 -[UIResponder _containsResponder:] + 36
	33  UIKit                               0x339c9190 -[UINavigationController defaultFirstResponder] + 76
	34  UIKit                               0x3385ca60 -[UIResponder(Internal) _deepestDefaultFirstResponder] + 24
	35  UIKit                               0x3385ca7c -[UIResponder(Internal) _deepestDefaultFirstResponder] + 52
	36  UIKit                               0x3385c8c8 -[UIResponder(Internal) _promoteDeepestDefaultFirstResponder] + 28
	37  UIKit                               0x3385c688 -[UIWindow makeKeyWindow] + 336
	38  UIKit                               0x3387e3d8 -[UIWindow makeKeyAndVisible] + 40
	39  Komfortmasken                       0x00046dd4 wrapper_managed_to_native_MonoTouch_ObjCRuntime_Messaging_void_objc_msgSend_intptr_intptr + 68
	40  Komfortmasken                       0x004343f4 Komfortmasken_AppDelegate_FinishedLaunching_MonoTouch_UIKit_UIApplication_MonoTouch_Foundation_NSDictionary + 616
	41  Komfortmasken                       0x0030ddd8 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
	42  Komfortmasken                       0x0058d130 mono_jit_runtime_invoke + 1644
	43  Komfortmasken                       0x006355bc mono_runtime_invoke + 128
	44  Komfortmasken                       0x00691d3c monotouch_trampoline + 3196
	45  UIKit                               0x3386cfd8 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1116
	46  UIKit                               0x33866a78 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 396
	47  UIKit                               0x338202e4 -[UIApplication handleEvent:withNewEvent:] + 1476
	48  UIKit                               0x3381fb1c -[UIApplication sendEvent:] + 68
	49  UIKit                               0x3381f3b4 _UIApplicationHandleEvent + 6824
	50  GraphicsServices                    0x35262c88 PurpleEventCallback + 1048
	51  CoreFoundation                      0x35e9a5cb __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 28
	52  CoreFoundation                      0x35e9a589 __CFRunLoopDoSource1 + 164
	53  CoreFoundation                      0x35e8c835 __CFRunLoopRun + 580
	54  CoreFoundation                      0x35e8c50b CFRunLoopRunSpecific + 226
	55  CoreFoundation                      0x35e8c419 CFRunLoopRunInMode + 60
	56  UIKit                               0x33865554 -[UIApplication _run] + 548
	57  UIKit                               0x33862558 UIApplicationMain + 972
	58  Komfortmasken                       0x0004c9bc wrapper_managed_to_native_MonoTouch_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 240
	59  Komfortmasken                       0x0042e530 Komfortmasken_Application_Main_string__ + 152
	60  Komfortmasken                       0x0030ddd8 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
	61  Komfortmasken                       0x0058d130 mono_jit_runtime_invoke + 1644
	62  Komfortmasken                       0x006355bc mono_runtime_invoke + 128
	63  Komfortmasken                       0x00639868 mono_runtime_exec_main + 436
	64  Komfortmasken                       0x0063e4dc mono_runtime_run_main + 756
	65  Komfortmasken                       0x005914b8 mono_jit_exec + 140
	66  Komfortmasken                       0x005896cc main + 2152
	67  Komfortmasken                       0x000029b8 start + 40

=================================================================
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.
=================================================================
Comment 1 Sebastien Pouliot 2012-07-16 09:57:36 UTC
`calendarIdentifier` is only available on iOS 5.0 and later versions [1].

Which version of iOS are you using when you get this exception ?

If you get this with iOS 5.0 (and later) then please provide a test case and we'll look into it.

[1] http://developer.apple.com/library/ios/#documentation/DataManagement/Reference/EKCalendarClassRef/Reference/Reference.html
Comment 2 Si Quy Lee 2012-07-16 10:09:55 UTC
Thanks for your information. I'm using iOS 4.2 so that's the reason makes app crashes.
Comment 3 Sebastien Pouliot 2012-07-16 10:20:51 UTC
You can either:

1. add a check around the use of `calendarIdentifier` to only use if in iOS 5.x, e.g.

if (UIDevice.CurrentDevice.CheckSystemVersion (5,0)) {
   /// use `calendarIdentifier`
}

2. avoid using this property
Comment 4 Si Quy Lee 2012-07-16 10:36:41 UTC
Thanks for your suggestion. I currently not use this property.