Iphone. Create a latitude from a string or integers

thomas picture thomas · Apr 19, 2010 · Viewed 13.1k times · Source

One small conversion problem that drives me crazy.

I have a string (ex "35.453454") that represents a latitude. I want to use it as a latitude for CLLocation.

How can I convert the string in the proper CLLocation (in degrees) format ?

Many thanks, this drives me so mad ! Thomas

Answer

kennytm picture kennytm · Apr 19, 2010

To convert an NSString to CLLocationDegrees (which is double):

return [theString doubleValue];