cllocationmanager

Calculating angle between two vectors?

旧时模样 提交于 2019-12-04 19:25:11
I'm developing an iOS app, which has to show POIs (points of interest) depending on device heading. I used CLLocationManager to get user's location and heading. I have one pair of destination's coordinates. Based on this I'm calculating which quarter is that and returning float value of deviation from south (0 degrees) in degrees. I have -/+180 degrees in the north and 0 in the south. Here is code snippet: -(float)updateTargetLongitude:(float)lon Latitude:(float)lat{ // //longitude = x // //latitude = y NSLog(@"current location = (%.5f, %.5f)", [[NSUserDefaults standardUserDefaults]

iPhone Core Location CLLocationManager update rate

怎甘沉沦 提交于 2019-12-04 19:02:30
Can you set up a constant time update rate for CLLocationManager to force it update locations like every 10 seconds continuously? I know the usage of the distance filter but what if something went wrong and the location is not updated? Thanks! It's not possible to control the update rate. You can set a timer, then turn off the updates until the timer ends. This is the usual thing to do to avoid using too much power. If there's a problem, you will be informed by the delegate method locationManager:didFailWithError: Here's a good post which shows how to filter bad CoreLocation readings: http:/

App won't relaunch when monitoring CLLocationManager significant location changes - iPhone

此生再无相见时 提交于 2019-12-04 18:36:34
I am working on an app that keeps track of user's location at a time-interval set by the user himself(e.g. every 5 minutes) and sends it to a server page by ASIHTTPRequest . This app should be able to receive updates on foreground, either on background or even when the app is not running(location services). Although my app successfully receives updates on the foreground and background, it does not seem to wake up when it is not running and do not send me up any requests to the server. I am using CLLocationManager and its delegate to perform startMonitoringSignificantLocationChanges for when it

iOS App Background Location (Push Notifications)

心已入冬 提交于 2019-12-04 18:19:28
I face an issue where my app requires the users location when they receive a push notification while the app is running in the background. After doing a bit of reading I'm under the impression that this isn't possible, i.e: 1) App in background 2) Push notification received 3) Get users location and execute block of code. I found this post on here that suggests you can run a task every N amount of minutes to get the users location. So using this I could check say every ten minutes which would work but it would be a waste of the users battery if I kept activating the GPS. Therefore I was

Finding Direction in iPhone like in Compass?

时间秒杀一切 提交于 2019-12-04 17:44:27
问题 Do any one have idea for finding true direction using iPhone? I want to implement such application in which I need to find direction in which iPhone is pointing and want to make application same as compass application in iphone 3GS. Does iPhone 3G supports compass functionality? And can any one tell me how compass application find directions so accurately like a real magnetic compass? Please help me for this. I am in a critical situation. Thanks in advance. 回答1: here is a sample code link

How to get location in background even after phone restart in swift?

梦想与她 提交于 2019-12-04 17:25:36
I'm developing an application which is tracking the location of the phone on time interval chosen by the user. I made it with timer which starts startUpdatingLocation , when it get the location stops updating sends the location to the server and starts timer again. Everything is done in background. I need to get location data in background mode (in iOS 8) even after phone restarts and send the data to a server. I tried hundreds methods and no one works for me. So ... what i've got at this moment: In info.plist: Required background modes - location and fetch NSLocationAlwaysUsageDescription -

Error : Assigning to 'CLLocationCoordinate2D' from incompatible type 'id'

允我心安 提交于 2019-12-04 17:21:45
Hai I am trying to display multiple annotations in mkmap. While am adding the coordinates it shows the error:"Assigning to 'CLLocationCoordinate2D' from incompatible type 'id'". I know this is a simple prob, but I have searched many times and tried a lot but none works, my code is, for(int i=0 ; i<coordinates.count ; i++) { MKPointAnnotation *point = [[MKPointAnnotation alloc] init]; point.coordinate =[coordinates objectAtIndex:i]; //here it shows the error point.title = @"title"; [self.mapView addAnnotation:point]; } kindly advice me to solve this prob. Thank you... As CLLocationCoordinate2D

iPhone Brainstorm - CLLocation in Background - Polling every 15 minutes

对着背影说爱祢 提交于 2019-12-04 16:56:44
Here is the scenario. I need to have an application which polls a web service with the users location every 15 minutes whether in background / foreground. At the moment I: Start / Restart the location manager with accuracy highest and distance filter none. Wait to get within desired accurancy. Store reading setDesiredAccuracy to be: "kCLLocationAccuracyThreeKilometers" setDistanceFilter to be: 1000 Set a performSelector:@selector(getLocation) withObject:nil afterDelay:900 Start again from step 1. I want to make this the most battery saving method possible and would like to see what fellow

Background location tracking: iOS

烂漫一生 提交于 2019-12-04 16:19:18
I'm trying to decide between Apple's significant location change services and start / stopping the location manager regularly myself. This is what Apple says about it : Gathering location data is a power-intensive operation. It involves powering up the onboard radios and querying the available cell towers, Wi-Fi hotspots, or GPS satellites, which can take several seconds. Leaving the standard location service running for extended periods can drain the device’s battery. (The significant-change location service drastically reduces battery drain by monitoring only cell tower changes, but the

Background location tracking not working on physical device swift

落花浮王杯 提交于 2019-12-04 16:04:57
I followed this tutorial ( https://www.raywenderlich.com/92428/background-modes-ios-swift-tutorial ) to create an app that maps the user's location in the background. It asks to follow the user's location even when the app is closed, the user presses yes, and it tracks location in the background, updating every second or so. It works perfectly in the simulator, but sideloaded onto a physical iPhone 6, it stops checking the user's location in the background. I solved this. If your background location tracking is working in the simulator but not on a physical phone running iOS 9 or later, it is