Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-03-2010, 03:45 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 98
rTicker is on a distinguished road
Default NSTimer Question

How would I do this:

Code:
timer = [NSTimer scheduledTimerWithTimeInterval:TextField target:self selector:@selector (Over) userInfo:nil repeats:NO];
rTicker is offline   Reply With Quote
Old 09-03-2010, 03:50 PM   #2 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 651
kapps11 is on a distinguished road
Default

Code:
timer = [NSTimer scheduledTimerWithTimeInterval:[textField.text intValue] target:self selector:@selector (Over:) userInfo:nil repeats:NO];
kapps11 is offline   Reply With Quote
Old 09-03-2010, 03:53 PM   #3 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 98
rTicker is on a distinguished road
Default

Thanks Kapps!

It works!
rTicker is offline   Reply With Quote
Old 09-13-2010, 12:13 AM   #4 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 12
Mixsiah is on a distinguished road
Default NSTimer Problem closes the app

simulated in iOS4.1

My app takes RSS data and loads in a table.

If it loads once it's fine....BUT the problem starts when I use the NSTimer to autorefresh every 10 seconds, it closes the app and goes back to homescreen.

Any suggestions?

- (void)viewDidAppearBOOL)animated {
[super viewDidAppear:animated];

if([blogEntries count] == 0) {
[self refreshData];
}

reloadTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(refreshData userinfo:nil repeats:YES];

}

- (void)refreshData{
NSString *blogAddress = @"http://twitter.com";
[self grabRSSFeed:blogAddress];
[blogTable reloadData];
}

- (void)viewWillDisappearBOOL)animated {
[reloadTimer invalidate], reloadTimer = nil;
}
Mixsiah is offline   Reply With Quote
Old 09-13-2010, 01:58 AM   #5 (permalink)
Registered Member
 
kelvinkao's Avatar
 
Join Date: Jul 2009
Location: Los Angeles
Posts: 352
kelvinkao is on a distinguished road
Send a message via AIM to kelvinkao
Default

The selector you added has a colon at the end, meaning it should take an argument. The method you defined, however, does not take an argument. When the run time cannot find a matching method, it crashes.
__________________
My dev blog:
http://www.kelvinkaodev.com
kelvinkao is offline   Reply With Quote
Old 09-13-2010, 07:59 AM   #6 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 12
Mixsiah is on a distinguished road
Default

Quote:
Originally Posted by kelvinkao View Post
The selector you added has a colon at the end, meaning it should take an argument. The method you defined, however, does not take an argument. When the run time cannot find a matching method, it crashes.
Hi Kelvin,

I took out the : and have this

selector:@selector(refreshData)

it is still closing the app...this line is the only problem...if i comment this line everything is fine.
Mixsiah is offline   Reply With Quote
Old 09-13-2010, 10:05 AM   #7 (permalink)
Registered Member
 
kelvinkao's Avatar
 
Join Date: Jul 2009
Location: Los Angeles
Posts: 352
kelvinkao is on a distinguished road
Send a message via AIM to kelvinkao
Default

If you read the documentation, you would find that the method must take an NSTimer as the argument.
__________________
My dev blog:
http://www.kelvinkaodev.com
kelvinkao is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 340
12 members and 328 guests
bignoggins, carlandrews, flamingliquid, hzwegjxg, ilmman, iram91419, linkmx, nadav@webtview.com, Objective Zero, Paul Slocum, stanny, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,656
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, iram91419
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:44 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0