Can't use CLLocationSpeed in iphone sdk 3.0

Discussion in 'iOS Programming' started by lyah01, Jun 12, 2009.

  1. lyah01 macrumors newbie

    Joined:
    Jun 12, 2009
    #1
    I developped a location-based application on iphone which uses CoreLocation.framework and I can't read the property CLLocationSpeed of the framework, described in the class CLLocation.h though it appears in my CLLocation.h file like it : "@property(readonly, nonatomic) CLLocationSpeed speed __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_2_2);" and my sdk runs with sdk 3.0.

    In my code I have the same architecture than the tutoriel Hello There (http://www.mobileorchard.com/hello-there-a-corelocation-tutorial/).

    Here is a sample of my code not working :

    Code:
    - (void)locationUpdate:(CLLocation *)location {
    	
    	CLLocationCoordinate2D loc = [location coordinate];
    	NSLog(@"lat : %f lon %f", loc.latitude, loc.longitude);
    
    	//here it crashes
    	CLLocationSpeed *speed = location.speed;
    
    
    Compilation display 3 errors :
    error: 'CLLocationSpeed' undeclared (first use in this function)
    error: 'speed' undeclared (first use in this function)
    error: request for member 'speed' in something not a structure or union


    Does anyone have an idea? I read all forums and never find the same problem.

    Thanks
     
  2. chocochum macrumors newbie

    Joined:
    Jun 25, 2009
    #2
    use
    CLLocationSpeed speed = location.speed;

    instead of
    CLLocationSpeed *speed = location.speed;
     

Share This Page