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 Im 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/B
rainloopMobile/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/B
rainloopMobile/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 whats 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