Q:

Objective-C : Trigger firedate from Integer variable? 

i want to use "firedate" for local notification.  How can i make use of an integer variable containing seconds to trigger firedate? 
int intTime;
intTime=([mAhLabel.text floatValue]/chargerSlider.value)*1.5*3600;
notif.fireDate = (intTime);

I know that the above code is wrong, just give me a hint guys!  Thanks in advance. 
p.s.  When i try to use this code i get "incompatible integer to pointer conversion assigning to 'NSDate * from int". 

A:

The fireDate must be an NSDate* so as you are aware your solution is incorrect.  If your calculation results in the seconds you want from the current time to fire then the following code would work. 
NSTimeInterval time = ([mAhLabel.text floatValue]/chargerSlider.value)*1.5*3600;
notif.fireDate = [NSDate dateWithTimeIntervalSinceNow:time];

Also make sure dividing by 0 is not possible using chargerSlider.value by either setting the min value or checking the value before division.  Otherwise the result would be NaN.

