iOS Question iEventKit Question - Getting notified of Event Changes

Erel

B4X founder
Staff member
Licensed User
Longtime User
refreshSourcesIfNecessary doesn't limit the events to the changed events.

You can use this code to add a listener:
B4X:
Sub AddListener
   Dim no As NativeObject = store
   Dim nstore As NativeObject = no.GetField("store")
   no = Me
   no.RunMethod("addStoreListener:", Array(nstore))
End Sub

Sub Store_Changed(Notification As Object)
   Log(Notification)
End Sub

#if OBJC
- (void)addStoreListener:(EKEventStore*) store {
   [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(eventStoreChangedNotification:) name:EKEventStoreChangedNotification object:nil];
    NSLog(@"Store listener added");

       
}
- (void)eventStoreChangedNotification:(NSNotification *)notification {
    NSLog(@"Event store changed");
   [self.bi raiseEvent:nil event:@"store_changed:" params:@[notification]];
}
#End If
 
Upvote 0
Top