-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
Hi,
Thanks for your sharing ^^
I have an ask about your last commit : "Add change notifications based on the Darwin notification center."
In DemoManager, there is this C function in an ObjC Class :
void sharedDataChangedCallback(CFNotificationCenterRef postingCenter,
void * observer,
CFStringRef name,
void const * object,
CFDictionaryRef userInfo)
{
// Springboard from Darwin notification center to NSNotificationCenter.
// Note that most of the received arguments are NULL with the Darwin notification center.
[[NSNotificationCenter defaultCenter] postNotificationName:kDemoNotesSaveByAppNotification object:[DemoNoteManager sharedManager]];
}In my Swift class, always this same C function :
func sharedDataChangedCallback(center: CFNotificationCenterRef,
observer: AnyObject,
name: CFString,
object: AnyObject,
userInfo: CFDictionaryRef)
{ NSNotificationCenter.defaultCenter().postNotificationName(kDemoNotesSaveByAppNotification , object: CoreDataStore.sharedInstance)
}When I call CFNotificationCenterAddObserver() in startObservingChangeNotifications() (in DemoManager) like that :
CFNotificationCenterAddObserver(center, nil, sharedDataChangedCallback, self.observingSaveNotificationName() as CFString!, nil, CFNotificationSuspensionBehavior.DeliverImmediately)My method sharedDataChangedCallbackin Swift isn't correct but I don't know how to solve my issue. Could you help me about that ?
Morever, you have never called "stopObservingChangeNotifications()" in DemoManager. In MastViewController, I think this code misses :
-(void) deinit {
DemoNoteManager *sharedManager = [DemoNoteManager sharedManager];
[sharedManager stopObservingChangeNotifications];
}Metadata
Metadata
Assignees
Labels
No labels
