cllocationmanager

Geolocation with local notification like reminder

邮差的信 提交于 2019-11-30 07:45:52
i want implement geolocation notification like the app reminders. this is what i have already done: in App delegate: self.locationManager = [[[CLLocationManager alloc] init] autorelease]; /* don't leak memeory! */ [self.locationManager setDelegate:self]; [self.locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; -(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region { } -(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region { } -(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { } And this

CLLocationManager on iPhone Simulator fails with kCLErrorDomain Code=0

与世无争的帅哥 提交于 2019-11-30 06:44:40
问题 CLLocationManager on iPhone Simulator is supposed to fake Cupertino (isn't it?) but it does NOT, it fails with kCLErrorDomain Code=0 instead. LocationManager's delegate receives the message didFailWithError . This method is implemented to log the error and the console outputs the following: Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)" I was working on a real project when I ran into this problem but it is pointless to discuss my code

Swift 2 – Can't get user location with CLLocationManager

╄→尐↘猪︶ㄣ 提交于 2019-11-30 06:02:19
问题 Here is my VC code: import UIKit import MapKit import CoreLocation class ViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate { @IBOutlet weak var mapView: MKMapView! let locationManager = CLLocationManager() override func viewDidLoad() { super.viewDidLoad() locationManager.delegate = self locationManager.requestWhenInUseAuthorization() mapView.showsUserLocation = true } func locationManager(manager: CLLocationManager, didChangeAuthorizationStatus status:

Geofencing iOS 6

↘锁芯ラ 提交于 2019-11-30 05:31:30
I am creating an app that tells the user whether they are near the destination. I am calculating the distance between the currentLocation and the destination. I'm doing the calculation inside the didUpdateLocations . It is working but I've seen that there are methods that can deal with that without the need of doing any math. I am registering the region in the CLLocationManager ; however it seems that the methods didExitRegion and didEnterRegion are not been called. Here are the part of the code where I register the region: - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { [self

How do I enable access to region monitoring service?

纵然是瞬间 提交于 2019-11-30 03:50:30
问题 I've simplified the question a bit. When I create and add regions in my app and interrogate the state of those regions I see the following in monitoringDidFailForRegion method: The operation couldn’t be completed. (kCLErrorDomain error 4.) Checking the CLErrorDomain constants I see that error 4 is kCLErrorRegionMonitoringDenied and it is described like so: Access to the region monitoring service was denied by the user. How is this possible? Here's my set up and what I've checked: I am working

Rotate GMSMarker in direction at which user facing

落花浮王杯 提交于 2019-11-30 03:28:59
I have requirement like on my current location one view will display. It will rotate if device was rotate or location will be change.I research lot but got all the code which have a fix location or angle at some location but i haven't fix location. Can anyone drive me at right direction. I also used rotation property of the GMSMarker but it is not working. - (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading { if (newHeading.headingAccuracy < 0){ NSLog(@"heading accuracy < 0"); return; } // Convert Degree to Radian and move the needle float oldRad = (-

UIBackgroundModes location and significant location changes with region monitoring

浪尽此生 提交于 2019-11-30 01:56:47
I have an app that uses a combination of startMonitoringForRegion: and startMonitoringSignificantLocationChanges to keep aware of where the user is when the app is in the background. Does this mean that I need to include the location value for the UIBackgroundModes key in the Info.plist ? This is a quote from the docs: The significant-change location service is highly recommended for apps that do not need high-precision location data. With this service, location updates are generated only when the user’s location changes significantly; thus, it is ideal for social apps or apps that provide the

CLLocation ask again for permission

陌路散爱 提交于 2019-11-30 00:56:41
问题 Currently my application asks only once for permission to use the current location. If the user doesn't allow, he isn't ask again unless he resets location warning in the general settings. I would like to give the user a chance from within the app to grant this permission later. In other words, the dialog should appear again if he presses a certain button. Is this possible? Thanks for your advice. 回答1: New Answer: Now in iOS 8 you CAN programatically open the device settings app: NSURL *url =

Hook in CLLocationManagerDelegate protocol

纵然是瞬间 提交于 2019-11-30 00:02:08
问题 I have a problem from 3 days :( I want to hook in CLLocationManagerDelegate protocol this method: - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations I tried everything but without success. I know how to hook into class or framework but I can't find a solution to hook a Delegate. Please help me! Thanks 回答1: Hooking requires you to provide objective-C class you would like to hook. This is what Class type is for. One way to get obj-c class is by name via

How Can I Continue updating my location even when app is killed or removed from background in ios?

♀尐吖头ヾ 提交于 2019-11-29 23:52:51
问题 My app requires to update location continuously, even if app is killed or removed from background. It works fine in foreground and even in background mode.but not working when app is killed. I've tried some code. func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { self.startLocationService() if ((launchOptions?[UIApplicationLaunchOptionsLocationKey]) != nil) { self.locationmanager = CLLocationManager() self