Results 1 to 3 of 3
  1. #1

    Member Since
    Oct 11, 2011
    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
    How To Get Rid Of Unused Variable Warning?
    basically i have this warning, its nothing big, it just bothers me that its there.

    heres my 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?

  2. #2

    Mark FX's Avatar
    Member Since
    Aug 13, 2011
    West Sussex, UK
    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.

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

    Hope this is of some help.

    Regards mark

  3. #3

    Member Since
    Oct 11, 2011
    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
    thanks for your help mark, i think I'm just going to rewrite my timer code to this:

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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 02-24-2011, 12:16 PM
  2. iWork etc - unused space at the side
    By Mikethebook in forum OS X - Apps and Games
    Replies: 3
    Last Post: 11-23-2009, 08:41 AM
  3. Unused Programs, Which ones do you not use
    By Steel02001 in forum Schweb's Lounge
    Replies: 17
    Last Post: 02-08-2007, 04:43 PM
  4. Deleting unused names?
    By Icarus in forum Community Suggestions and Feedback
    Replies: 4
    Last Post: 08-17-2004, 12:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts