CLLocation - Not Working...

Discussion in 'iOS Programming' started by RMK-Jacob, Jul 18, 2012.

  1. RMK-Jacob, Jul 18, 2012
    Last edited: Jul 18, 2012

    RMK-Jacob macrumors newbie

    Joined:
    Mar 24, 2012
    #1
    Hi,

    So I am using CLLocation and CLLocation manager and the method locationManager:didUpdateToLocation:fromLocation isn't running. In my viewDidLoad I placed the following:
    Code:
    theLocation = [[CLLocationManager alloc] init];
    [theLocation setDelegate: self];
    [theLocation setDesiredAccuracy:kCLLocationAccuracyBest];
    theLocation.distanceFilter = kCLDistanceFilterNone;
    [theLocation startUpdatingLocation];
    In the locationManager:didUpdateToLocation:fromLocation i placed a NSLog. The info that I put into the NSLog isn't showing up in the debugger, so I know that the
    locationManager:didUpdateToLocation:fromLocation method isn't even running.

    Please try to help me and tell me what I should do to fix.

    UPDATE: The problem seems to be that the locationManager:didUpdateToLocation:fromLocation method is returning (null).

    Thanks,
    RMK-JACOB
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
  3. RMK-Jacob thread starter macrumors newbie

    Joined:
    Mar 24, 2012
    #3
    Both. I tried on device: doesn't work... I tried on simulator: doesn't work
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    Did you deny the app access:

    "The user has the option of denying an application’s access to the location service data. During its initial uses by an application, the Core Location framework prompts the user to confirm that using the location service is acceptable. If the user denies the request, the CLLocationManager object reports an appropriate error to its delegate during future requests."
     
  5. RMK-Jacob thread starter macrumors newbie

    Joined:
    Mar 24, 2012
    #5
    Nope. I granted access. The method locationManager:didUpdateToLocation:fromLocation is returning a (null) value for no reason.
     
  6. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #6
    Post your code. The complete code of the whole method, not separate isolated lines.


    Isolated lines

    have
    no context
    It's not

    even clear

    Code:
    if
    
    they're in
    the same method.
     
  7. iJustinCabral macrumors member

    iJustinCabral

    Joined:
    Jul 8, 2012
    #7
    Need full code please...


    No idea what your doing with it.
     
  8. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #8

    You said:

    That method is a void method. It doesn't return anything. You mean one or more of the values passed into that method are null?

    As the other posters said, post the full code for your locationManager:didUpdateToLocation:fromLocation: method.
     
  9. RMK-Jacob thread starter macrumors newbie

    Joined:
    Mar 24, 2012
    #9
    The didUpdateToLocation:(CLLocation*)newLocation. The newLocation variable is null. Sorry for not specifying what was wrong.
     
  10. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #10
    post the method!
     

Share This Page