Post

Replies

Boosts

Views

Activity

Merge results from NSURLSession back on to the main thread UI
I have apps that send requests for route between 2 locations and search, filter then display facilities near the route. The apps first send a request for the route on a background thread, then based on route, search for facilities near certain locations on or near the route. There maybe multiple searches on the same route, each on a different location. Suitable results then are displayed on the map. Apps also do live updates. However, since I have switched to using NSURLSession to search for the route on a background thread, not all suitable results/pin are displayed. Certain pins only show up upon the next didUpdateToLocation call. So my question is, what is the best practice to sync the results on the UI? Why do only some of the results show up on the UI, and others don't.
1
0
187
Jul ’24
Merge results from NSURLSession back on to the main thread UI
I have apps that send requests for route between 2 locations and search, filter then display facilities near the route. The apps first send a request for the route on a background thread, then based on route, search for facilities near certain locations on or near the route. There maybe multiple searches on the same route, each on a different location. Suitable results then are displayed on the map. Apps also do live updates. However, since I have switched to using NSURLSession to search for the route on a background thread, not all suitable results/pin are displayed. Certain pins only show up upon the next didUpdateToLocation call. So my question is, what is the best practice to sync the results on the UI? Why do only some of the results show up on the UI, and others don't.
1
0
294
Jul ’24
How to find latitudeDelta & longitudeDelta of the visible map area
I am trying to calculate the  latitudeDelta & longitudeDelta of visible map area on the phone screen. The two method used were: spanLat = map.visibleMapRect.size.width / 111000; spanLon = map.visibleMapRect.size.height / (111000 * cos(centreLat*3.14159/180)); And MKMapRect mRect = map.visibleMapRect; MKMapPoint eastMapPoint = MKMapPointMake(MKMapRectGetMinX(mRect), MKMapRectGetMidY(mRect)); MKMapPoint westMapPoint = MKMapPointMake(MKMapRectGetMaxX(mRect), MKMapRectGetMidY(mRect));     MKMapPoint northMapPoint = MKMapPointMake(MKMapRectGetMinY(mRect), MKMapRectGetMidX(mRect)); MKMapPoint southMapPoint = MKMapPointMake(MKMapRectGetMaxY(mRect), MKMapRectGetMidX(mRect));     CLLocationDistance wLength = MKMetersBetweenMapPoints(eastMapPoint, westMapPoint); CLLocationDistance hLength = MKMetersBetweenMapPoints(northMapPoint, southMapPoint);       spanLat = wLength / 111000;   spanLon = hLength / (111000 * cos(centreLat*3.14159/180)); Neither gives me right  latitudeDelta & longitudeDelta of the visible area.
2
0
969
May ’22