NSTimer 呼び出しのために userInfo を介してデータを渡そうとしています。これを行う最善の方法は何ですか?NSDictionary を使用しようとしています。Objective-C オブジェクトがある場合、これは十分に単純ですが、他のデータはどうでしょうか? 私はこのようなことをしたいのですが、そのままでは機能しません:
- (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];
}