New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
iOS Development Discussion on developing apps for the iOS platform.

How To Get Rid Of Unused Variable Warning?


Post Reply New Thread Subscribe

 
Thread Tools
Loon3y

 
Member Since: Oct 11, 2011
Posts: 38
Loon3y is on a distinguished road
Mac Specs: 13" MacBook Pro 2.4 GHz 8 GB Ram 250 GB HD, iPhone 4/S 64 GB, iPhone 3GS 16 GB, iPad 16 GB Wi-Fi

Loon3y is offline
basically i have this warning, its nothing big, it just bothers me that its there.

heres my code:



Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    GlobalStrings* theDataObject = [self theGlobalClass];
    theDataObject.deviceUDID =  [[UIDevice currentDevice] name];
    
    self.locationManager = [[CLLocationManager alloc] init];
    locationManager.desiredAccuracy = kCLLocationAccuracyBest;
    locationManager.delegate = self;
    [locationManager startUpdatingLocation];
    

    NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(sendGPS) userInfo:nil repeats:YES];
    

    
    return YES;
}

i used to have "timer release" at the bottom, but it had errors as this method is connected with another method in the app delegate.


so i had to get rid of it from crashing.


is there anything i can just put in here that useless that'll get rid of it?
QUOTE Thanks
Mark FX

 
Mark FX's Avatar
 
Member Since: Aug 13, 2011
Location: West Sussex, UK
Posts: 167
Mark FX has a spectacular aura about

Mark FX is offline
Not sure exactly what your question is, but if it's about not getting warnings for your unused
timer variable you have two obvious options.

first you can disable the warnings for unused variables in the project build settings, under
the Apple LLVM compiler 3.0 - warnings heading, make sure you only switch these off for
the project, and not for the target app, but be warned this is not advised as you will not
get any warnings about unused variables throughout any your project files.

Second you could use the timer variable in an NSLog statement to get rid of the warnings,
even though the log statement has no other debug purposes, like this.

[CODE]
NSLog(@"time interval = %f", [timer timeInterval]);
[/CODE

Hope this is of some help.

Regards mark
QUOTE Thanks
Loon3y

 
Member Since: Oct 11, 2011
Posts: 38
Loon3y is on a distinguished road
Mac Specs: 13" MacBook Pro 2.4 GHz 8 GB Ram 250 GB HD, iPhone 4/S 64 GB, iPhone 3GS 16 GB, iPad 16 GB Wi-Fi

Loon3y is offline
thanks for your help mark, i think I'm just going to rewrite my timer code to this:


Code:
[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(sendGPS:) userInfo:nil repeats:YES];
QUOTE Thanks

Post Reply New Thread Subscribe


« Toggle button question | Can you recommend a legit method or site to develop my app idea? »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
llvm gcc 4.2 install? wfs123 OS X - Development and Darwin 16 01-24-2012 04:13 PM
Building Mac-On-Linux Dreamcast270mhz Running Windows (or anything else) on your Mac 3 04-03-2010 10:04 AM
first mac , i'm not pleased lilmill Switcher Hangout 34 12-17-2007 09:05 PM
error message during weekly maintenance ajresovsky Schweb's Lounge 0 06-18-2006 05:11 PM

All times are GMT -4. The time now is 02:46 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?