iOS Question Pass List from OBJC

wineos

Member
Licensed User
Longtime User
Here is my code:

B4X:
#If OBJC
-(B4IList *) fetcheventswithrange: (NSString *) sd : (NSString *) ed
{
    B4IList* lst = [B4IList new];

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
   
    [dateFormatter setDateFormat:@"yyyy/M/d"];
    NSDate *sDate = [dateFormatter dateFromString:sd];
    NSDate *eDate = [dateFormatter dateFromString:ed];

    NSPredicate *predicate = [store predicateForEventsWithStartDate:sDate endDate:eDate calendars:nil];
   
    NSArray *events = [store eventsMatchingPredicate:predicate];
    NSArray *sortedEvents = [events sortedArrayUsingSelector:@selector(compareStartDateWithEvent:)];

    lst.object = sortedEvents;
    return lst;
}
#End If

Sub Show
        Dim lst As List
        lst.Initialize

        Dim no As NativeObject = Me
        lst = no.RunMethod("fetcheventswithrange::", Array(sDate, eDate))
        .....
End Sub

Error Message:

Error occurred on line: 715 (frmMain)
Expected: NSArray, object type: B4IList
Stack Trace: (
CoreFoundation <redacted> + 150
libobjc.A.dylib objc_exception_throw + 38
CoreFoundation <redacted> + 0
Bible Calendar -[B4IObjectWrapper setObject:] + 364
CoreFoundation <redacted> + 68
CoreFoundation <redacted> + 292
Bible Calendar +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1788
Bible Calendar -[B4IShell runVoidMethod] + 210
Bible Calendar -[B4IShell raiseEventImpl:method:args::] + 1924
Bible Calendar -[B4IShellBI raiseEvent:event:params:] + 1332
Bible Calendar __22-[b4i_frmmain ek_init]_block_invoke + 290
TCC <redacted> + 242
TCC <redacted> + 28
libxpc.dylib <redacted> + 30
libxpc.dylib <redacted> + 26
libdispatch.dylib <redacted> + 1572
libdispatch.dylib <redacted> + 94
libsystem_pthread.dylib 0x361a1e29 _pthread_wqthread + 1024
libsystem_pthread.dylib 0x361a1a18 start_wqthread + 8
)

Can Anyone help?

Thank you.
 
Top