पर कॉल नहीं करता है, अब मैं वास्तव में निराश हूं, पूरे इंटरनेट को गुमराह कर रहा हूं, एसओ के माध्यम से ठोकर खा रहा हूं और अभी भी कोई समाधान नहीं मिला है।NSTimer विधि
मैं एक एनएसटीमर लागू करने की कोशिश कर रहा हूं, लेकिन जिस पद्धति को मैंने परिभाषित किया है उसे कॉल नहीं किया जाता है। (सेकंड सही ढंग से सेट होते हैं, इसे ब्रेकपॉइंट्स के साथ चेक किया जाता है)।
- (void) setTimerForAlarm:(Alarm *)alarm {
NSTimeInterval seconds = [[alarm alarmDate] timeIntervalSinceNow];
theTimer = [NSTimer timerWithTimeInterval:seconds
target:self
selector:@selector(showAlarm:)
userInfo:alarm repeats:NO];
}
- (void) showAlarm:(Alarm *)alarm {
NSLog(@"Alarm: %@", [alarm alarmText]);
}
वस्तु "theTimer" @property साथ deined है::
@interface FooAppDelegate : NSObject <NSApplicationDelegate, NSWindowDelegate> {
@private
NSTimer *theTimer;
}
@property (nonatomic, retain) NSTimer *theTimer;
- (void) setTimerForAlarm:(Alarm *)alarm;
- (void) showAlarm:(Alarm *)alarm;
क्या मैं गलत कर रहा हूँ यहाँ कोड है?
'शो अलार्म: (अलार्म *) अलार्म' के लिए विधि हस्ताक्षर 'showAlarm: (NSTimer *) टाइमर' होना चाहिए। फिर आपको अलार्म ऑब्जेक्ट 'अलार्म * अलार्म = [टाइमर उपयोगकर्ता इन्फॉर्म]' मिलेगा। – 0xced
धन्यवाद, इसे पहले से मिला है ;-) – tamasgal