Can't use CLLocationSpeed in iphone sdk 3.0

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

  1. lyah01 macrumors newbie

    Jun 12, 2009
    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 (

    Here is a sample of my code not working :

    - (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.

  2. chocochum macrumors newbie

    Jun 25, 2009
    CLLocationSpeed speed = location.speed;

    instead of
    CLLocationSpeed *speed = location.speed;

Share This Page