Another bug caused my app crashed...
When I create an event:
Dim no As NativeObject = ev
no.SetField("calendar", Calendars.Get("CSCShift"))
no.SetField("notes", tfNote2.Text)
store.SaveEvent(ev, False)
When I read the events:
TableViewEventList.Clear
For Each e As CalendarEvent In listEventTable
intEvent = intEvent + 1
stringNote = ""
Dim no As NativeObject = e
Dim note As NativeObject
note.Initialize("")
If no.GetField("hasNotes").AsBoolean = True Then
note = no.GetField("notes")
Log(note)
' If note <> Null Then
stringNote = "(" & note.AsString & ")"
' End If
End If
TableViewEventList.AddTwoLines(intEvent & ". " & e.Title & " ⏰" & DateTime.Date(e.StartDate) & "~" &DateTime.Date(e.EndDate), " " & stringNote)
Next
TableViewEventList.ReloadAll
But sometimes the app crashed and the error logs showed that
<B4INativeObject: (null)>
Error occurred on line: 830 (Main)
Object was not initialized (NSObject)
Therefore, I added log to list "CalendarEvent " details.
If the app worked fine, the logs:
*********************************
Application_Start
Application_Active
Class (b4i_xml2map) instance released.
Class (b4i_xml2map) instance released.
listEventTable:
<B4IList: (
"EKEvent <0x28171c7e0>\n{\n\t EKEvent <0x28171c7e0>\n{\t title = \t\t\U5176\U4ed6; \n\t location = \t(null); \n\t calendar = \tEKCalendar <0x283014b40> {title = CSCShift; type = CalDAV;
allowsModify = YES; color = #CC73E1;}; \n\t alarms = \t\t(null); \n\t URL = \t\t\t(null); \n\t lastModified = 2020-09-18 05:36:11 +0000; \n\t startTimeZone = \tAsia/Taipei (GMT+8) offset 28800; \n\t startTimeZone = \tAsia/Taipei (GMT+8) offset 28800 \n}; \n\t location = \t(null); \n\t structuredLocation = \t(null); \n\t startDate = \t2020-09-19 05:30:00 +0000; \n\t endDate = \t\t2020-09-19 05:35:00 +0000; \n\t allDay = \t\t0; \n\t floating = \t0; \n\t recurrence = \t(null); \n\t attendees = \t(null); \n\t travelTime = \t(null); \n\t startLocation = \t(null);\n};",
"EKEvent <0x281701950>\n{\n\t EKEvent <0x281701950>\n{\t title = \t\t\U8acb\U5047; \n\t location = \t(null); \n\t calendar = \tEKCalendar <0x283016d40> {title = CSCShift; type = CalDAV;
allowsModify = YES; color = #CC73E1;}; \n\t alarms = \t\t(null); \n\t URL = \t\t\t; \n\t lastModified = 2020-09-18 05:04:01 +0000; \n\t startTimeZone = \tAsia/Taipei (GMT+8) offset 28800; \n\t startTimeZone = \tAsia/Taipei (GMT+8) offset 28800 \n}; \n\t location = \t(null); \n\t structuredLocation = \t(null); \n\t startDate = \t2020-09-27 03:27:00 +0000; \n\t endDate = \t\t2020-09-27 03:27:00 +0000; \n\t allDay = \t\t0; \n\t floating = \t0; \n\t recurrence = \t(null); \n\t attendees = \t(null); \n\t travelTime = \t(null); \n\t startLocation = \t(null);\n};"
)>
*********************************
If the app crashed, the logs:
Application_Start
Application_Active
Class (b4i_xml2map) instance released.
Class (b4i_xml2map) instance released.
Time: 401
listEventTable:
<B4IList: (
"EKEvent <0x282f77720>\n{\n\t EKEvent <0x282f77720>\n{\t title = \t\t\U5176\U4ed6; \n\t location = \t(null); \n\t calendar = \tEKCalendar <0x28084a900> {title = CSCShift; type = CalDAV;
allowsModify = NO; color = #CC73E1;}; \n\t alarms = \t\t(null); \n\t URL = \t\t\t(null); \n\t lastModified = (null); \n\t startTimeZone = \tAsia/Taipei (GMT+8) offset 28800; \n\t startTimeZone = \tAsia/Taipei (GMT+8) offset 28800 \n}; \n\t location = \t(null); \n\t structuredLocation = \t(null); \n\t startDate = \t2020-09-19 05:30:00 +0000; \n\t endDate = \t\t2020-09-19 05:35:00 +0000; \n\t allDay = \t\t0; \n\t floating = \t0; \n\t recurrence = \t(null); \n\t attendees = \t(null); \n\t travelTime = \t(null); \n\t startLocation = \t(null);\n};",
"EKEvent <0x282f72c70>\n{\n\t EKEvent <0x282f72c70>\n{\t title = \t\t\U8acb\U5047; \n\t location = \t(null); \n\t calendar = \tEKCalendar <0x28084af80> {title = CSCShift; type = CalDAV;
allowsModify = NO; color = #CC73E1;}; \n\t alarms = \t\t(null); \n\t URL = \t\t\t(null); \n\t lastModified = (null); \n\t startTimeZone = \tAsia/Taipei (GMT+8) offset 28800; \n\t startTimeZone = \tAsia/Taipei (GMT+8) offset 28800 \n}; \n\t location = \t(null); \n\t structuredLocation = \t(null); \n\t startDate = \t2020-09-27 03:27:00 +0000; \n\t endDate = \t\t2020-09-27 03:27:00 +0000; \n\t allDay = \t\t0; \n\t floating = \t0; \n\t recurrence = \t(null); \n\t attendees = \t(null); \n\t travelTime = \t(null); \n\t startLocation = \t(null);\n};",
)>
*********************************
note = no.GetField("notes")
Log(note)
log(note) --> <B4INativeObject: (null)>
What could I do to solve this?
Any help and information is greatly appreciated.