Does not help. As I said there are two exceptions. Other one is crashing at the 
constructor. Randomly. Same input data(same calendar events). 

Grüße, René

Am 08.04.2012 um 12:56 schrieb Nic Wise <[email protected]>:

> Try it without this
> 
> BackgroundColor = new UIColor (oEvent.Calendar.CGColor)
> 
> And/or report (log) what oEvent.Calendar.CGColor is.
> 
> 
> 
> On Fri, Apr 6, 2012 at 19:16, René Ruppert <[email protected]> 
> wrote:
>> Hi,
>> 
>> 
>> 
>> I have posted the exception before, but now I can add the piece of code that
>> is causing it.
>> 
>> This is what gets executed ViewDidLoad(). I want to get all events in a one
>> month range:
>> 
>> 
>> 
>> EKEventStore oStore = new EKEventStore ();
>> 
>> NSPredicate oPredicate = oStore.PredicateForEvents (this.EventRangeStart,
>> this.EventRangeEnd, oStore.Calendars);
>> 
>> oStore.EnumerateEvents (
>> 
>>   oPredicate,
>> 
>>   delegate(EKEvent oEvent, ref bool bStop)
>> 
>>   {
>> 
>>     LocalEventItem oLocalEvent = new LocalEventItem ()
>> 
>>     {
>> 
>>       ID = -1,
>> 
>>       Name = oEvent.Title,
>> 
>>       StartDate = oEvent.StartDate,
>> 
>>       EndDate = oEvent.EndDate,
>> 
>>       Description = oEvent.Notes,
>> 
>>       EventType = LocalEventItem.EVENT_TYPE.Local,
>> 
>>       Location = oEvent.Location,
>> 
>>       BackgroundColor = new UIColor (oEvent.Calendar.CGColor)
>> 
>>     } ;
>> 
>>     aEvents.Add (oLocalEvent); bStop = false; } );
>> 
>>   }
>> 
>> );
>> 
>> 
>> 
>> And these are the exceptions I’m getting randomly (for same input
>> parameters!) when the above gets executed. I pasted two variations of the
>> exception below.
>> 
>> Both crash in the search callback. One when accessing the start date, the
>> other when trying to get the color of the event.
>> 
>> 
>> 
>>> CRASH @ 06.04.2012 11:28:53
>>> MONOTOUCH VERSION: 5.3.2
>>> TERMINATING:True
>>> EXCEPTION:
>>> System.NullReferenceException: Object reference not set to an instance of
>>> an object
>>>  at MonoTouch.Foundation.NSObject.InitializeObject (Boolean alloced)
>>> [0x00000] in
>>> /Developer/MonoTouch/Source/monotouch/src/Foundation/NSObject.cs:122
>>>  at MonoTouch.Foundation.NSObject..ctor (MonoTouch.Foundation.NSObjectFlag
>>> x) [0x0000d] in
>>> /Developer/MonoTouch/Source/monotouch/src/Foundation/NSObject.cs:54
>>>  at MonoTouch.UIKit.UIColor..ctor (MonoTouch.CoreGraphics.CGColor color)
>>> [0x00000] in <filename unknown>:0
>>>  at
>>> BrainloopMobile.Calendar.BaseCalendarViewModeController+<GetEventsInRange>c__AnonStorey38.<>m__AA
>>> (MonoTouch.EventKit.EKEvent oEvent, System.Boolean& bStop) [0x00000] in
>>> /Users/rene/Documents/Develop/Projects/BrainloopMobile/210/BrainloopMobile/BrainloopMobile/Controllers/Calendar/ViewModes/BaseCalendarViewModeController.cs:48
>>>  at MonoTouch.EventKit.EKEventStore.TrampolineEKEventSearchCallback
>>> (IntPtr block, IntPtr theEvent, System.Boolean& stop) [0x0004d] in
>>> /Developer/MonoTouch/Source/monotouch/src/EventKit/EKEventStore.g.cs:477
>>>  at (wrapper native-to-managed)
>>> MonoTouch.EventKit.EKEventStore:TrampolineEKEventSearchCallback
>>> (intptr,intptr,int&)
>> 
>> 
>> 
>> CRASH @ 06.04.2012 11:42:25
>> 
>> MONOTOUCH VERSION: 5.3.2
>> 
>> BRAINLOOP MOBILE VERSION: 2.1.0.120405
>> 
>> TERMINATING:True
>> 
>> EXCEPTION:
>> 
>> System.NullReferenceException: Object reference not set to an instance of an
>> object  at MonoTouch.ObjCRuntime.Runtime.ConstructNSObject (IntPtr ptr,
>> IntPtr klass) [0x0000d] in
>> /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:205
>> 
>> at MonoTouch.ObjCRuntime.Runtime.GetNSObject (IntPtr ptr) [0x0001f] in
>> /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:254
>> 
>> at MonoTouch.EventKit.EKEvent.get_StartDate () [0x0000b] in
>> /Developer/MonoTouch/Source/monotouch/src/EventKit/EKEvent.g.cs:159
>> 
>> at
>> BrainloopMobile.Calendar.BaseCalendarViewModeController+<GetEventsInRange>c__AnonStorey38.<>m__AA
>> (MonoTouch.EventKit.EKEvent oEvent, System.Boolean& bStop) [0x00000] in
>> /Users/rene/Documents/Develop/Projects/BrainloopMobile/210/BrainloopMobile/BrainloopMobile/Controllers/Calendar/ViewModes/BaseCalendarViewModeController.cs:48
>> 
>> at MonoTouch.EventKit.EKEventStore.TrampolineEKEventSearchCallback (IntPtr
>> block, IntPtr theEvent, System.Boolean& stop) [0x0004d] in
>> /Developer/MonoTouch/Source/monotouch/src/EventKit/EKEventStore.g.cs:477
>> 
>> at (wrapper native-to-managed)
>> MonoTouch.EventKit.EKEventStore:TrampolineEKEventSearchCallback
>> (intptr,intptr,int&)=
>> 
>> 
>> 
>> Any ideas what’s going on? Are there alternatives to the code above that I
>> could try?
>> 
>> 
>> 
>> René
>> 
>> 
>> 
>> 
>> _______________________________________________
>> MonoTouch mailing list
>> [email protected]
>> http://lists.ximian.com/mailman/listinfo/monotouch
>> 
> 
> 
> 
> -- 
> Nic Wise
> t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
> b. http://www.fastchicken.co.nz/
> 
> Earnest: Self-employed? Track your business expenses and income.
> http://earnestapp.com
> Nearest Bus: find when the next bus is coming to your stop. 
> http://goo.gl/Vcz1p
> mobileAgent (for FreeAgent): get your accounts in your pocket.
> http://goo.gl/IuBU
> Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
> London Bike App: Find the nearest Boris Bike, and get riding! 
> http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to