• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
'NSTimer' may not respond to '+scheduledTimerWithTimeInterval:target:selector:userinfo:repeats:'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

'NSTimer' may not respond to '+scheduledTimerWithTimeInterval:target:selector:userinfo:repeats:'


  • Subject: 'NSTimer' may not respond to '+scheduledTimerWithTimeInterval:target:selector:userinfo:repeats:'
  • From: Brad Lee <email@hidden>
  • Date: Wed, 14 Jul 2010 10:15:39 -0700
  • Importance: Normal

I am a noob to ObjC programming.  I am trying to write a simple stopwatch app to get my feet wet but I am having a problem with the timer function.

compiler warns me that 'NSTimer' may not respond to '+scheduledTimerWithTimeInterval:target:selector:userinfo:repeats:'

When I run my app I get an exception: +[NSObject doesNotRecognizeSelector:]

Which then of course dumps my app.

Thanks to anyone who can help a newbie moron. :)

Here is my code.

.h file
...................................................................................

#import <UIKit/UIKit.h>

#import <Foundation/Foundation.h>


@interface ActiveStructController : NSObject {

 

IBOutlet UILabel *ActiveLabel;

        NSTimer *repTimer;

NSTimer *timer;

}


- (IBAction)ChangeActiveLabel:(id)sender;

- (IBAction)PauseButtonClick:(UIButton *)sender;

- (IBAction)StartButtonClick:(UIButton *)sender;

- (IBAction)StopButtonClick:(UIButton *)sender;

- (void) updClk:(NSTimer *)sender;


@property (assign) NSTimer *repTimer;



@end


....................................................................................

.m file

....................................................................................

#import "ActiveStructController.h"

#import "StopWatch_BasicAppDelegate.h"




@implementation ActiveStructController

@dynamic repTimer;



- (IBAction)ChangeActiveLabel:(id)sender {


}


- (IBAction)PauseButtonClick:(UIButton *)sender {

    

}


- (IBAction)StartButtonClick:(UIButton *)sender {

timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updClk:) userinfo:self repeats:YES];


self.repTimer = timer; // reference to timer

}


- (IBAction)StopButtonClick:(UIButton *)sender {

[repTimer invalidate];

[repTimer release];

}


- (void)updClk:(NSTimer *)theTimer

{

int MinuteVal = 20;

int SecondVal = 00;

NSLog (@"Got Here %d:%d",MinuteVal,SecondVal);

}


@end




Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox. Learn more.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: 'NSTimer' may not respond to '+scheduledTimerWithTimeInterval:target:selector:userinfo:repeats:'
      • From: "Hank Heijink (Mailinglists)" <email@hidden>
    • Re: 'NSTimer' may not respond to '+scheduledTimerWithTimeInterval:target:selector:userinfo:repeats:'
      • From: Wim Lewis <email@hidden>
    • Re: 'NSTimer' may not respond to '+scheduledTimerWithTimeInterval:target:selector:userinfo:repeats:'
      • From: Dix Lorenz <email@hidden>
  • Prev by Date: Re: Xcode keeps changing my simulator from iPad 3.2 to iPhone 4.0
  • Next by Date: Re: 'NSTimer' may not respond to '+scheduledTimerWithTimeInterval:target:selector:userinfo:repeats:'
  • Previous by thread: Re: Xcode keeps changing my simulator from iPad 3.2 to iPhone 4.0
  • Next by thread: Re: 'NSTimer' may not respond to '+scheduledTimerWithTimeInterval:target:selector:userinfo:repeats:'
  • Index(es):
    • Date
    • Thread