core-location

provide simple method to get current speed (implementing speedometer)

时间秒杀一切 提交于 2020-01-13 14:27:04
问题 Could you please give me example how to calculate current "speed", I'm working on my first simple app ala speedometer? I figure out to use didUpdateToLocation also I found that I need to use formula speed = distance / duration Is it right? how to calculate duration? 回答1: The basic steps that you need to go through look something like this: Create a CLLocationmanager instance Assign a delegate with the appropriate callback method Check to see if the "speed" is set on the CLLocation in the

iPhone SDK: Do I need to ask user for permissions to use GPS?

独自空忆成欢 提交于 2020-01-13 09:56:05
问题 In my iPhone application I need to use GPS (CoreLocation to be exact) to get current position of the device. I know that most (if not all) applications using GPS have a popup implemented asking the user to allow GPS access. Is that done automatically by the iPhone SDK or should I implement such functionality myself? I've tried to run my app on iPhone Simulator and it didn't ask for permissions at all so I'm wondering if the same thing will happen on the actual phone. And if I implement that

What is the difference between MKCoordinateSpan and CLLocationCoordinate2D

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-13 08:53:12
问题 I was going through the sample example of MapKit and CoreLocation framework. I found these two structs ( MKCoordinateSpan and CLLocationCoordinate2D ) which are similar in declaration. How are these different in functionality, can someone please site an example (using both) to clear their meanings. Thanks! 回答1: MKCoordinateSpan defines a span , i.e. a delta, in the latitude and longitude directions to show on a map. Along with a point you can then define a region to display on a map.

iOS 6 Map problems with MKUserTrackingModeFollowWithHeading

时间秒杀一切 提交于 2020-01-12 08:47:26
问题 I'm trying to solve two problems with MKUserTrackingModeFollowWithHeading in iOS 6: MKUserTrackingModeFollowWithHeading works briefly, but it's jittery and returns to MKUserTrackingModeFollow almost immediately, especially at high zoom levels. The app occasionally crashes when repeatedly changing the MKUserTrackingMode : I get EXC_BAD_ACCESS on the main thread, without further information. This is hard to reproduce, but it has happened repeatedly. Any thoughts on what might be causing this?

Location update even when app is killed/terminated

时光总嘲笑我的痴心妄想 提交于 2020-01-12 05:36:09
问题 I am trying to get location updates even in all states, even when app is killed/terminated/suspended. I have enabled background fetch in xcode and implemented the following code(used reference "Capture location in all states app"). But when i terminate the app it's giving a red line on class AppDelegate. I do not understand what is the problem here.I have done this using the solution of the question "Getting location for an iOS app when it is in the background and even killed" here, But its

iphone core location: distance filter how does it work?

江枫思渺然 提交于 2020-01-12 03:55:11
问题 What exactly the property locationmanager.distancefilter do? Does it determine how often the didUpdateTolocation method gets called?? 回答1: It filters out short moves. So if CL detects that the device moved 20 meters, but your distance filter is set to 30m you will not be notified. Once the position has moved enough to exceed your distance filter setting then you will get a didUpdateToLocation callback. It is very common for GPS position results to wander even when a device isn't moving. You

locationManager:rangingBeaconsDidFailForRegion:withError: kCLErrorDomain 16

孤人 提交于 2020-01-12 03:42:09
问题 I have read CLLocationManager kCLErrorDomain Codes? as well as Apple Docs I check to make sure ranging is available before calling startRangingBeaconsInRegion: and I am also checking if ranging is available while in the locationManager:rangingBeaconsDidFailForRegion:withError: method. Returns true both times. When I get the set of monitoredRegions, my beacon is in the set (so registering for monitoring is working). I have read that error 16 can mean ranging is unavailable, bluetooth could be

Change Pin direction in iOS Map

 ̄綄美尐妖づ 提交于 2020-01-10 20:14:16
问题 SWIFT 3.0 MKMAPVIEW iOS Note : - (Integrated AppleMap ,Not working with GoogleMap ) I have done the following : Implemented map and Added custom Image to User Location Annotation When map open , it shows User Location at right Place My Requirement : When User Move into different direction staying at same place (or different place) the pin (at current location) should automatically point the direction in which user points. E.g : If Boat is showing at User Location position and its pointing

Centering MKMapView on spot N-pixels below pin

为君一笑 提交于 2020-01-07 08:08:09
问题 Want to center MKMapView on a point N-pixels below a given pin ( which may or may not be visible in the current MapRect ). I've been trying to solve this using various plays with -(CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view to no success. Anyone been down this road ( no pun intended )? 回答1: The easiest technique is to just shift the map down, say 40% from where the coordinate would be, taking advantage of the span of the region of the MKMapView . If

Centering MKMapView on spot N-pixels below pin

ε祈祈猫儿з 提交于 2020-01-07 08:08:07
问题 Want to center MKMapView on a point N-pixels below a given pin ( which may or may not be visible in the current MapRect ). I've been trying to solve this using various plays with -(CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view to no success. Anyone been down this road ( no pun intended )? 回答1: The easiest technique is to just shift the map down, say 40% from where the coordinate would be, taking advantage of the span of the region of the MKMapView . If