Post not yet marked as solved
Hi,
I have to build an app that allow my colleagues to see each others current position by checking a map (let's skip that "find my" works really well for this).
Since we have different offices around the city, it must give us the chance to look for a specific address and see who of our colleagues are close to that location.
I can find a way to code this but how do I have to structure the project? I mean start/end task in general terms..
It would be a tremendous help
Thanks
Andres
Post not yet marked as solved
I am working on an app that shows Sun's orbit path around the current locations.
Followed these steps.
Get current location with CLLocationManager
Get Azimuth and Elevation details of Sun with respect to current date time and location details
Covert Azimuth and Elevation spherical coordinates to Cartesian XYZ coordinates to show on ARKit.
Show final coordinates on Arkit and draw the path
I have verified the Azimuth and Elevation angle details with the reference app and coming perfectly.
But after converting it to Cartesian coordinate, it never shows to correct place in ARKit.
Conversion code:
public Vector3 PerformCalculations(BRSunSphericalPosition sphericalPosition)
{
Vector3 vector = new Vector3();
vector.X = (float)(radius * Math.Cos(DegreeToRadians(sphericalPosition.Elevation)) * Math.Cos(DegreeToRadians(sphericalPosition.Azimuth)));
vector.Y = (float)(radius * Math.Cos(DegreeToRadians(sphericalPosition.Elevation)) * Math.Sin(DegreeToRadians(sphericalPosition.Azimuth)));
vector.Z = (float)(radius * Math.Sin(DegreeToRadians(sphericalPosition.Elevation)));
return vector;
}
And showing on ARKit:
System.Numerics.Vector3 sunPosition = coordinateCalculator.PerformCalculations(position);
var sphereNode = new SCNNode();
sphereNode.Geometry = SCNSphere.Create(0.05f);
sphereNode.Geometry.FirstMaterial.Diffuse.Contents = TimeView(time);
sphereNode.Position = new SCNVector3(sunPosition.X, sunPosition.Y, sunPosition.Z);
arSCNView.Scene.RootNode.AddChildNode(sphereNode);
But this code never shows the sphere point tracking to the sun, It's very very off from the exact point.
For example: When it's around 12:30 PM it should be at the top and at night 12:30 AM sun's position should be at the bottom.
Here I have used Xamarin C# language, but I am looking for a native iOS solution.
Post not yet marked as solved
The code available for download at : https://developer.apple.com/documentation/mapkit/mapkit_annotations/annotating_a_map_with_custom_data
Does not work, line 18 of CustomAnnotationView.swift :
private let blurEffect = UIBlurEffect(style: .systemThickMaterial)
returns with error that :
Type 'UIBlurEffect.Style' has no member 'systemThickMaterial'
Post not yet marked as solved
I was reading a thread about this earlier today, and alas didn't bookmark it, or I would continue it... even if the thread is 6+ years old.
Someone was asking if GPS (and by extension, Location Services including changing timezones, etc) worked in airplane-mode.
Since then:
the FAA has relaxed rules about using mobile devices on aircraft that radiate RF energy;
new radio chips with different architectures have emerged;
etc.
While it might have been the case that shutting down the cellular PHY (transceiver) also killed the GPS receiver, that might not be the case today. Or is it a deliberate decision in iOS design that airplane-mode turns off GPS, even though GPS is a passive receiver that doesn't radiate RF, and whether the transceiver/receiver can be enabled separately or not is moot?
I'm thinking of a use-case where a citizen journalist might be photo-documenting events in his country (and wanting to attach time/location metadata to photographs as he takes them) without wanting to emit any sort of RF signature that might allow state security services to track him (i.e. using WiFi certified location services or cellular service for time or AGPS+).
Thanks
Post not yet marked as solved
We are working on a project that communicates location data via a network.
We are able to get the Location Services to work using:
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Location data will be used to monitor your position</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location data will be used to monitor your position</string>
And we able to get the networking functionality to work using:
<key>NSBonjourServices</key>
<array>
<string>_appName-data._tcp</string>
<string>_appName-data._udp</string>
<string>_appName-chat._tcp</string>
<string>_appName-chat._tcp</string>
</array>
and
<key>NSLocalNetworkUsageDescription</key>
<string>appName needs to use your phone's data to discover devices nearby</string>
However, we are only able to use these independently. When both are included together, the NSBonjourServices quits working, but the location services works.
Any one know what needs to be done to have both working together?
Hey everyone,
I wanted to ask you guys a question. I'm trying to build an app that shows buses routes. For instance, let's say that Blue Bus is going to Cupertino St but the bus I see coming right now (the Red Bus) is going to Palo Alto St, which is a block away from Cupertino Street.
I'd better off taking the Red Bus which goes a bit out of way than waiting 10 or more minutes for the right bus (Here, the Blue Bus).
Ok, that's what I'm trying to do.
How do I want to do this? I'm thinking of drawing the lines of each specific bus route on the map of the app. So I can look at the app and know the routes, be able to zoom in or zoom out, and etc. I don't need to do directions, time, buses, etc. It should be relatively simple.
Any thoughts? I'm not sure how to draw the buses routes. Thank you!!!
Post not yet marked as solved
I get
Error Domain=kCLErrorDomain Code=1 "(null)" in the Xcode console when a start to update for location. This does not happen in the example app, so I'm wondering what I might have done wrong?
How can one prevent auto-zooming with IOS MapKit when using userTrackingMode = .followWithHeading? That is I am setting the current user location to the centre of the screen, and have "view.userTrackingMode = .followWithHeading" so that the map orientates to north, but when you zoom in/out manually the MapView automatically overrides this and zooms back to the level it seems to prefer being at.
I was to be able to zoom in, then the zoom level stays like this, whilst it keeps the map centred to user location, and keeps auto-rotating to keep map aligned to north.
I am using SwiftUI so have effectively do have the location being passed into GCMapView as a parameter (as the means to keep the SwiftUI GCMapView up to date with latest user location). So not sure if this is causing an issue?
Some key bits (have pulled some code out to show relevant lines) of the MapKit call backs I'm using:
struct FlightView: View {
@EnvironmentObject var locationManager : GCLocationManager
@State var centreUserLocation : Bool = false
var body: some View {
GCMapView(
flight: flight,
userLocation: locationManager.userLocation,
centreUserLocation: centreUserLocation,
initalZoomDone: initalZoomDone
)
}
}
struct GCMapView : UIViewRepresentable {
let map = MKMapView()
func makeUIView(context: Context) -> MKMapView {
map.delegate = context.coordinator
map.isRotateEnabled = true
map.userTrackingMode = .followWithHeading
map.showsUserLocation = true
return map
}
func updateUIView(_ view: MKMapView, context: Context) {
if let userLocation = userLocation {
view.centerCoordinate = userLocation
view.userTrackingMode = .followWithHeading // Needed to keep map rotating to align to North
}
}
func makeCoordinator() -> Coordinator {
return Coordinator(self)
}
class Coordinator: NSObject, MKMapViewDelegate {
var parent: GCMapView
init(_ parent: GCMapView) {
self.parent = parent
super.init()
}
}
}
Post not yet marked as solved
I am looking into using the location push service extension for iOS 15 enterprise app to display the current location of other service technicians. However, when I try to request the entitlement, I get "You're not eligible to make this request, even though I am the Account Holder for this Enterprise Account.
If I try to request using my personal developer account, I can request the entitlement.
https://developer.apple.com/contact/request/location-push-service-extension/
https://developer.apple.com/documentation/corelocation/cllocationmanager/creating_a_location_push_service_extension
Hello,
I would like to store, save users data inside the app (Best option to store it in the cloud) with location the user reach. The loaction check in point on the map is within radius 100 meters. So the thing I would like to do is to show as a list in the second viewcontroller Zdobyte Szczyty, names of the locations sczyt.name from the first ViewController (the one with the map) that user reached (clicked with a button to check in). I thought about adding a button to the annotation view, which should do the check in if the user is in this radius - but it does not show me the button, just pin. Here is my code:
import UIKit
import MapKit
class ViewController: UIViewController, MKMapViewDelegate{
let locationManager = CLLocationManager()
struct Szczyt {
let name: String
let opis: String
let lattitude: CLLocationDegrees
let longtitude: CLLocationDegrees
var coordinate: CLLocationCoordinate2D {
.init(latitude: lattitude, longitude: longtitude)
}
}
@IBOutlet weak var mapView: MKMapView!
@IBAction func mapTypeSegmentSelected(_ sender: UISegmentedControl) {
switch sender.selectedSegmentIndex {
case 0:
mapView.mapType = .standard
case 1:
mapView.mapType = .satellite
default:
mapView.mapType = .hybrid
}
}
private(set) var circles: [MKCircle]!
let szczyty = [Szczyt(name: "one", opis: "describtion", lattitude: 53.865061725039226, longtitude: 17.708595782487315),
Szczyt(name: "two", opis: "describtion2", lattitude: 55.893874478583854, longtitude: 24.896341184611302),
Szczyt(name: "Skrzyczne", opis: "describtion3", lattitude: 49.685059170137386, longtitude: 19.030076144463138)]
override func viewDidLoad() {
super.viewDidLoad()
mapView.register(MKMarkerAnnotationView.self, forAnnotationViewWithReuseIdentifier: "identifier")
checkLocationServices()
znajdzSzczytyNaMapie(szczyty)
circles = szczyty.map {
MKCircle(center: $0.coordinate, radius: 100)
}
mapView.addOverlays(circles!)
mapView.delegate = self
}
func checkLocationServices() {
if CLLocationManager.locationServicesEnabled() {
checkLocationAuthorization()
} else {
// Show alert letting the user know they have to turn this on.
}
}
func checkLocationAuthorization() {
switch CLLocationManager.authorizationStatus() {
case .authorizedWhenInUse:
mapView.showsUserLocation = true
case .denied: // Show alert telling users how to turn on permissions
break
case .notDetermined:
locationManager.requestWhenInUseAuthorization()
mapView.showsUserLocation = true
case .restricted: // Show an alert letting them know what’s up
break
case .authorizedAlways:
break
}
}
func znajdzSzczytyNaMapie(_ szczyty: [Szczyt]) {
for szczyt in szczyty {
let annotations = MKPointAnnotation()
annotations.title = szczyt.name
annotations.subtitle = szczyt.opis
annotations.coordinate = CLLocationCoordinate2D(latitude:
szczyt.lattitude, longitude: szczyt.longtitude)
mapView.addAnnotation(annotations)
}
}
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
guard !(annotation is MKUserLocation) else { return nil }
//let annotationView = MKMarkerAnnotationView(annotation: annotation, reuseIdentifier: "MyMarker")
let identifier = "identifier"
//guard let annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier) as? MKMarkerAnnotationView else { return nil }
guard let annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier, for: annotation) as? MKMarkerAnnotationView else { return nil }
let btn = UIButton(type: .detailDisclosure)
annotationView.rightCalloutAccessoryView = btn
switch annotation.title!! {
case "one":
annotationView.markerTintColor = UIColor(red: 0.86, green: 0.99, blue: 0.79, alpha: 1.00)
annotationView.glyphImage = UIImage(named: "one_pic")
case "two":
annotationView.markerTintColor = UIColor(red: 0.80, green: 0.98, blue: 0.73, alpha: 1.00)
annotationView.glyphImage = UIImage(named: "two_pic"")
case "Skrzyczne":
annotationView.markerTintColor = UIColor(red: 0.02, green: 0.61, blue: 0.69, alpha: 1.00)
annotationView.glyphImage = UIImage(named: "three_pic"")
default:
annotationView.markerTintColor = UIColor.green
annotationView.glyphImage = UIImage(named: "default")
}
return annotationView
}
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
let circleRenderer = MKCircleRenderer(overlay: overlay)
circleRenderer.strokeColor = UIColor.green
circleRenderer.fillColor = UIColor.green
circleRenderer.alpha = 0.3
circleRenderer.lineWidth = 1.0
return circleRenderer
}
}
This is my Zdobyte Szczyty viewcontroller:
import UIKit
import SwiftUI
class Zdobyte_ViewController: UIViewController {
struct ContentView: View {
var body: some View {
Text("Test viewcontroller gór")
}
}
override func viewDidLoad() {
super.viewDidLoad()
}
}
Here is the button view I would like to have with the pin image, but now it only shows the pin with the image:
This is how my viewcontrollers view looks like:
Post not yet marked as solved
We have followed the guideline for Location push extension per documentation, however we're getting the following error response:
Response:
* Connection state changed (MAX_CONCURRENT_STREAMS == 1000)!
* We are completely uploaded and fine
< HTTP/2 400
< apns-id: xxxxxx
<
* Connection #0 to host api.development.push.apple.com left intact
{"reason":"DeviceTokenNotForTopic"}* Closing connection 0
Request:
curl -v \
-d '{"aps":{"alert":"Testing.. (0)","badge":1,"sound":"default"}}' \
-H "apns-topic: ***.location-query" \
-H "apns-push-type: location" \
-H "apns-priority: 10" \
--http2 \
--cert-type P12 --cert ~/Desktop/push_cert/push_p12.p12 \
https://api.development.push.apple.com/3/device/xxxxxxx
Documentation:
https://developer.apple.com/documentation/corelocation/cllocationmanager/creating_a_location_push_service_extension
There's no documentation about the json payload, It would be great if someone can clarify what could be the issue
Post not yet marked as solved
Hello, does anyone know, is it possible to remove the street names from the map when navigating, if possible, please tell me how to do it?
Post not yet marked as solved
Recently, after upgrading to iOS 15 beta and later the iOS 15, my iPhone 12 has started coving the whole map with blue color. I suspect it is the approximate blue location circle expanded to the size of the earth.
I followed what was suggested in other topics by double-checking the location services, and exact location permission.
Also removed and re-installed the map app.
Post not yet marked as solved
Hi, i want to track the GPS position when the user is moving with your car..
But, the user aways forget to run app in your device....
this app is for vehicle insurance, so...the users will be alerted that this app is running..
1 - There's any way how to identify when the user is driving in background mode and start track current location? (I don't wanna any user action)
2 - I was thinking to create a BackgroundTasks for listening when the user is driving but, it is possible?
I am looking to share official GIS data with Apple Maps for our county. Does anyone know where or how to do this? I am the 911 director for the county. Thanks.
Post not yet marked as solved
I am working on an App that tracks location coordinates from a starting point to an end point and calculates the mileage of the route. The location manager is set with a distance filter of 10, desired accuracy is kCLocationAccuracyBestForNavigation, pausesLocationUpdatesAutomatically is false. In the locationUpdated function of the location listener, I filter out coordinates with horizontalAccuracy greater than 100.
The problem is that, in iOS 15, if the route is indoors (wifi based location tracking), locationUpdated function gets called with inaccurate location values with good horizontalAccuracy value. For example, even when the device is stationary, it gets a stream of locations with distances varying from 60m to 100m from the previous location in the stream. As a result, the calculated mileage becomes inaccurately inflated. I tested with larger distance filter (e.g. 50m, 80m, 100m), but the issue persists.
The same code works perfectly, both indoors and outdoors, in iOS 14.8. The locationUpdated function gets called with accurate location value after the device has moved the distance set in the distance filter. Why I am getting bad location values in iOS 15 and is there a known solution to it?
Post not yet marked as solved
Hello, Our app requires When in Use Authorisation to work. Is it a good head to use CLLocationButton to ask for this Authorisation for iOS 15 users?
We tried using this button but it only shows only two options OK and Not Now as shown in this pic. Is it possible to show When in Use Authorisation here?
Post not yet marked as solved
Hi guys,
I have built a PWA that calls the javascript API navigator.geolocation.getCurrentPosition which prompts the user for location access when the Safari permission is set to Ask. This is the correct behavior and works as expected when open in Safari.
However when added to the Home Screen and running with a display mode of "standalone", the location alert does not open on my phone (iPhone 13 mini / iOS 15.1.1). And the call never times out. Then if I switch from the PWA to Safari the location alert / prompt is suddenly showing in Safari. So it seems that the alert is targeting the wrong "tab". This does not happen if the PWA display mode is "browser" or "mimimal-ui" with either of those it behaves normally.
I can only replicate this on my phone (iPhone 13 mini / iOS 15.1.1). I have also tested on various older phones (15.1.1 and 14.7) as well as several emulators and they all behave as expected.
It is possible this is a obscure setting on my phone but it does feel a lot like an iOS Safari bug.
Post not yet marked as solved
I can draw more than around 8000 default red markers without setting icon property for marker.
But I want to draw markers with different colors depending upon marker's value.
In XCOde I get below warning:-
"((null)) was false: Reached the max number of texture atlases, can not allocate more.
((null)) was false: Failed to get the icon for the given CGImageRef.
((null)) was false: Failed to allocate texture space for marker"
from Google Map SDK & after that around 1300 markers it gets crashed.
Is there any other way to set different colors to markers without crashing for more than 1300 markers.
I am setting marker's colour like below:-
marker.icon = GMSMarker.markerImage(with: self.getColorsFromString(strColor: strColor))
func getColorsFromString(strColor:String) -> UIColor
{
var color = UIColor()
switch strColor {
case "GREEN":
color = UIColor.green
case "YELLOW":
color = UIColor.yellow
case "RED":
color = UIColor.red
case "ORANGE":
color = UIColor.orange
case "BLUE":
color = UIColor.blue
case "CYAN":
color = UIColor.cyan
case "MAGENTA":
color = UIColor.magenta
default:
color = UIColor.red
print("default color")
}
return color
}
Post not yet marked as solved
Hello,
I am currently working to develop an automated attendance tracking system for a senior project at a university. The project uses React Native, and BLE iBeacons. They are asking that I check every 5 minutes to see what beacons are near me so that I could say yes I’m here in class or no I wasn’t in class. From what documentation I have seen, it is pretty much impossible to send requests any sooner than 15 minutes apart. However, most of it is a couple years old or not relating to background refreshing.
Is that 15 minute minimum to several hour maximum based on user’s use of the app still accurate, or has anything changed? The app is aiming to send requests to a server every 5 minutes, while running in the background such that the student wouldn’t have to be on their phone/ have the app open the whole class. If there’s not a way to send requests every 5 minutes in the background, is there a possibility that a push notification library could somehow be used instead?
Thank you,
Aaron