I can initialize a CLLocation object by providing latitude and longitude like below:
CLLocation *location =  [[CLLocation alloc] initWithLatitude:-43.242534 longitude:-54.93662];
How can I initialize a CLLocation object with not only latitude and longitude but also accuracy values?
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)
                              altitude:-1
                    horizontalAccuracy:desired_horizontal_accuracy
                      verticalAccuracy:desired_vertical_accuracy
                             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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With