我也陷入了困境,我正试图把一个NSString或一个NSNumber放进initWithLatitude去CLLocation.如果有人能提供帮助就会很棒.
继承人的代码
CLLocation *location1 = [[CLLocation alloc] initWithLatitude:53.778702 longitude:-0.271887];
CLLocation *location2 = [[CLLocation alloc] initWithLatitude:53.683267 longitude:-0.011330];
label.text = [NSString stringWithFormat:@"Distance in miles: %4.1f", [location1 distanceFromLocation:location2]/1609.344];
[location1 release];
Run Code Online (Sandbox Code Playgroud)
我试图取代[[CLLocation alloc] initWithLatitude:53.778702 longitude:-0.271887]与[[CLLocation alloc] initWithLatitude:lat longitude:lon]