on the init i have :
dict = [[NSMutableDictionary alloc] init]; //dict is NSMutableDictionary
then i am adding him numbers:
[dict setObject:@"SPOT1" forKey:[NSNumber numberWithInt:array[0] ]] ;
[dict setObject:@"SPOT2" forKey:[NSNumber numberWithInt:array[1] ]] ;
[dict setObject:@"SPOT3" forKey:[NSNumber numberWithInt:array[2] ]] ;
[dict setObject:@"SPOT4" forKey:[NSNumber numberWithInt:array[3] ]] ;
[dict setObject:@"SPOT5" forKey:[NSNumber numberWithInt:array[4] ]] ;
NSLog(@"dictionary:%@",dict);
the array[] has a GOOD values.
the NSLog print only the last spot5.(the rest of them lost)
and if am trying to send that dict (with this 1 value), with NSNotificationCenter i got it as null !
so it some how released.
why?
edit for the NSNotificationCenter :
[[NSNotificationCenter defaultCenter] postNotificationName:@"DigitalArrived" object:nil userInfo:dict];//post
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getSensorsData:) name:@"DigitalArrived" object:nil]; //get
thanks a lot.
Might be
arrayelements are all same. Pl. check that. If all are same, then value for the key will be replaced in theNSDictionaryinstead of adding new pair.