userlocation

Location Query in Parse TableView

偶尔善良 提交于 2019-12-24 22:25:28
问题 I have a PFQueryTableView which is supposed to gather the 10 closest store locations and display them in order of proximity. I query the tableview like so: - (PFQuery *)queryForTable { PFQuery *query = [PFQuery queryWithClassName:@"TopToday"]; query.limit = 7; CLLocation *currentLocation = locationManager.location; PFGeoPoint *userLocation = [PFGeoPoint geoPointWithLatitude:currentLocation.coordinate.latitude longitude:currentLocation.coordinate.longitude]; return query; } The above code

showsUserLocation does not display blue dot in iPhone 4.0

核能气质少年 提交于 2019-12-23 02:52:11
问题 So, I've created a CLLocationManager, called it to start updating, set mapView.showsUserLocation to YES, and returned nil for the userLocation annotation. Here are some snippets from my code in my UIMapViewController: - (void)viewDidLoad { CLLocationManager *locationManager = [[CLLocationManager alloc] init]; [locationManager startUpdatingLocation]; } - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {

Determine Country associated with Apple ID logged into the iOS device

蹲街弑〆低调 提交于 2019-12-22 08:19:52
问题 I have a particular scenario in my application where some content (coming from service) needs to be displayed based on location or say country of the user. There are two/three ways I figured out by which I could accomplish this but they have some disadvantages as mentioned below. 1) Using NSLocale NSLocale *locale = [NSLocale currentLocale]; NSString *countryCode = [locale objectForKey: NSLocaleCountryCode]; Disadvantage:Can be changed by user, this is configurable from Setting->General -

Check if user location is inside a shape

北战南征 提交于 2019-12-21 06:38:16
问题 I made this method to check if an user location is inside a polygon on a map view (mapkit). I pass to the method the current user location (CLLocationCoordinate2D) and return a boolean just to know if the user is in a polygon or not. func userInsidePolygon(userlocation: CLLocationCoordinate2D ) -> Bool{ // get every overlay on the map let o = self.mapView.overlays // loop every overlay on map for overlay in o { // handle only polygon if overlay is MKPolygon{ let polygon:MKPolygon = overlay as

how to update user location in both foreground and background every 10 seconds? [duplicate]

倾然丶 夕夏残阳落幕 提交于 2019-12-14 04:15:08
问题 This question already has an answer here : Update location in Background (1 answer) Closed last year . I'm making a location tracking app. In this app, I need to record user location every 10 seconds. Also, the recording is done in a background service so that the application does not need to be in foreground. To make this, I tried to use Timer but it's not working in background. I've tried so much but it didn't work. Could you help me please? I found this great tutorial: https://www

Center map on user's location (Google Maps API v3)

情到浓时终转凉″ 提交于 2019-12-14 03:35:00
问题 I've looked a lot of various other reports about this problem, but I can't find the solution to get the location of user. Here is my code: <script src='https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true'> </script> <script> // prepare variables var main = document.getElementById('main'); // async XHR request var xhReq = new XMLHttpRequest(); xhReq.open('GET','../data/data.json', true); xhReq.onload = function (e) { if ((xhReq.readyState === 4) && (xhReq.status === 200)) { // prepare

Facebook Android SDK 4.0+ user_location?

梦想与她 提交于 2019-12-12 03:25:27
问题 I'm trying hard to get User's country but I'm not able to get it. Not able to understand what exactly is wrong here ? I'm referring this documentation. This is what I have tried so far - public interface IFacebokLoginConstants extends ILoginConstants { String KEY_FIRST_NAME = "first_name"; String KEY_LAST_NAME = "last_name"; String KEY_EMAIL = "email"; String KEY_NAME = "name"; String KEY_LOCATION = "location{location}"; String[] READ_PERMISSIONS = {"public_profile", "email", "user_friends",

Check if the user location is near of some points

别说谁变了你拦得住时间么 提交于 2019-12-12 02:49:54
问题 I have a question about GPS alarm. I have some points (latitude and longitude). I need a way to check if the user location is near to some of these points (approximately are 1800 points). If I remember correctly there is a best practice to do this: to be notified when GPS position is in a certain region. This allows for optimizations regarding the battery. Can you give me any suggestions? 回答1: 1800 points as per 1800 different regions to be monitored? It is not possible. See here: For this

MKMapView's user location is wrong on startup or resume

这一生的挚爱 提交于 2019-12-08 17:24:42
问题 When I start my application fresh, or resume after a long time, MKMapView's notion of the userLocation is wrong and shows me in the middle of the sea. I am using the following code: self.mapView.centerCoordinate = self.mapView.userLocation.location.coordinate; [mapView setCenterCoordinate:self.mapView.userLocation.location.coordinate zoomLevel:ZOOM_LEVEL animated:YES]; Happens after a lengthy resume of the app or brand new start.... 回答1: That's the expected behavior : the user location isn't

Check if user location is visible on map iphone

故事扮演 提交于 2019-12-06 01:44:37
问题 I want to hide or show a UIButton weather user's current location is visible on map. While testing the code xcode I can see meassage "User location view is NOT visible but should be. Showing...." on console in "didUpdateLocation" method if users location is not visible on map. How can I use this message to generate events in my case to hide or show a UIButton? Thanks for any help in advance. 回答1: If you want to know whether the user location is contained in the currently displayed map region,