tranvutuan
tranvutuan

Reputation: 6109

getting an error when trying to use location service in simulator

I am working the location service in iphone and I cant get any location at all in the simulator and what I am getting now is

error is Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)"
error code is 0

and the long and lat are all 0 as well.

I am wondering why I cant get any specific location.... I am not so sure if this is a problem because I am in the building with full concrete......

Please help me if you have experienced it before

Upvotes: 0

Views: 144

Answers (1)

chaitanya.varanasi
chaitanya.varanasi

Reputation: 956

Could you please post your code?

By default, Apple location is set at Cupertino. Maybe you should also try to import the MapKit framework which can be done from the (Build Phases Tab, Link Binaries section).

You can also try setting a region to fix your longitude/latitude problem (aka not have zeroes), with this code

 MKCoordinateRegion region = {{0.0,0.0},{0.0,0.0}};
    region.center.latitude= //enter latitude number;
    region.center.longitude= //enter longitude number;
    region.span.longitudeDelta= 0.01f;
    region.span.latitudeDelta= 0.01f;
    [mapView setRegion:region animated:YES];

Upvotes: 2

Related Questions