Instance Method

initWithLatitude:longitude:

Creates a location object with the specified latitude and longitude.

Declaration

- (instancetype)initWithLatitude:(CLLocationDegrees)latitude longitude:(CLLocationDegrees)longitude;

Parameters

latitude

The latitude of the geographical coordinate.

longitude

The longitude of the geographical coordinate.

Return Value

A location object initialized with the specified geographical coordinate.

Discussion

Use this method to create location objects that are not necessarily based on the user's current location. Typically, you acquire location objects from your CLLocationManager object, which returns the user's actual location. However, you might use this method when you want to represent any location on a map. For example, you might create an object to represent the user's intended destination.

This method records the latitude and longitude values you provide, and it initializes other properties to appropriate default values. Specifically, this method sets the altitude and horizontalAccuracy properties to 0, sets the verticalAccuracy property to -1 to indicate that the altitude is invalid, sets the speed and course values to -1, and sets the timestamp property to the time at which the returned object was created.

See Also

Initializing a Location Object

- initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:timestamp:

Creates a location object with the specified coordinate and altitude information.

- initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:course:speed:timestamp:

Creates a location object with the specified coordinate, altitude, and course information.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software