error accessing timer's userInfo
error accessing timer's userInfo
- Subject: error accessing timer's userInfo
- From: Chunk 1978 <email@hidden>
- Date: Sat, 23 Jan 2010 19:33:07 -0500
i'm receiving an unrecognized selector sent to instance crash with the
following code, but i can't figure out why. the program crashes when
trying to set the timer's user info into local variables in
fadeCallBack:
___________________
//Create Dictionary To Add To The Timer's userInfo Parameter
NSMutableDictionary *timerUserInfoDictionary = [[NSMutableDictionary
alloc] init];
[timerUserInfoDictionary setObject:[NSNumber
numberWithInteger:soundID] forKey:@"soundID"];
[timerUserInfoDictionary setObject:[NSNumber
numberWithFloat:targetVolume] forKey:@"targetVolume"];
[timerUserInfoDictionary setObject:[NSNumber
numberWithFloat:duration] forKey:@"duration"];
//Execute Fade
self.fadeStartDate = [NSDate date];
NSDate *now = [fadeStartDate addTimeInterval:0];
NSTimer *timer = [[NSTimer alloc] initWithFireDate:now interval:0.15
target:self selector:@selector(fadeCallBack:)
userInfo:timerUserInfoDictionary repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
self.fadeTimer = timer;
[timerUserInfoDictionary release];
[timer release];
}
- (void)fadeCallBack:(NSTimer *)timer
{
//Timer's User Info
NSUInteger soundID = [[timer userInfo] integerForKey:@"soundID"];
float targetVolume = [[timer userInfo] floatForKey:@"targetVolume"];
float duration = [[timer userInfo] floatForKey:@"duration"];
___________________
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden