Tengo un NSNotification que está publicando un NSDictionary:objeto de acceso pasado en NSNotification?
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
anItemID, @"ItemID",
[NSString stringWithFormat:@"%i",q], @"Quantity",
[NSString stringWithFormat:@"%@",[NSDate date]], @"BackOrderDate",
[NSString stringWithFormat:@"%@", [NSDate date]],@"ModifiedOn",
nil];
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:@"InventoryUpdate" object:dict]];
¿Cómo me suscribo a esto y obtener información de este NSDictionary?
en mi viewDidLoad que tengo:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recieveInventoryUpdate:) name:@"InventoryUpdate" object:nil];
y un método en la clase:
- (void)recieveInventoryUpdate:(NSNotification *)notification {
NSLog(@"%@ updated", [notification userInfo]);
}
que registra un valor nulo, por supuesto.
[versión Swift] (http://stackoverflow.com/a/42180596/1634890) –