Estoy tratando de pasar datos a través de userInfo para una llamada NSTimer. ¿Cuál es la mejor manera de hacer esto? Estoy tratando de usar un NSDictionary, esto es bastante simple cuando tengo objetos Objective-C, pero ¿y otros datos? Yo a querer hacer algo como esto, que no funciona como es:Pasar datos a través de NSTimer UserInfo
- (void)play:(SystemSoundID)sound target:(id)target callbackSelector:(SEL)selector
{
NSLog(@"pause ipod");
[iPodController pause];
theSound = sound;
NSMutableDictionary *cb = [[NSMutableDictionary alloc] init];
[cb setObject:(id)&sound forKey:@"sound"];
[cb setObject:target forKey:@"target"];
[cb setObject:(id)&selector forKey:@"selector"];
[NSTimer scheduledTimerWithTimeInterval:0
target:self
selector:@selector(notifyPause1:)
userInfo:(id)cb
repeats:NO];
}
¿Es 'cb' nil cuando se llega a' -notifyPause1: '? –