Leem.fin Leem.fin - 1 year ago 150
Objective-C Question

create CLLocation object in objective-c

I can initialize a

object by providing latitude and longitude like below:

CLLocation *location = [[CLLocation alloc] initWithLatitude:-43.242534 longitude:-54.93662];

How can I initialize a
object with not only latitude and longitude but also accuracy values?

Answer Source

As per apple docs you can use the following function:

double desired_horizontal_accuracy = 200.0 // in meters
double desired_vertical_accuracy = 200.0 // in meters
[[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(-43.242534,-54.93662)
                             timestamp:[NSDate date]]

In the example, for the parameters altitude and timestamp, I put the same defaults as what the apple docs say are used on -initWithLatitude:longitude:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download