Post

Replies

Boosts

Views

Activity

Creating an annotation with longpress, suppresses tap handling for the map
I am creating annotations, by handling a longpress gesture.It works just fine.However, once the annotation is created, neither the annotation nor the map seem to recognize the tap gesture, and in order to get the callout, I have to tap twice on my annotation.Is this normal? I have reproduced this 100% using samples, and it seems to happen only after a longpress gesture has been handled.Is this a known issue? Does anyone know how to get around this?Thank you!Here is the code I am working with:@IBOutlet weak var mapView: MKMapView!// In ViewDidLoad let uilpgr = UILongPressGestureRecognizer(target: self, action: #selector(createNewAnnotation)) uilpgr.minimumPressDuration = 0.25 mapView.addGestureRecognizer(uilpgr)// The selector@objc func createNewAnnotation(_ sender: UIGestureRecognizer) { let touchPoint = sender.location(in: self.mapView) let coordinates = mapView.convert(touchPoint, toCoordinateFrom: self.mapView) let heldPoint = MKPointAnnotation() heldPoint.coordinate = coordinates if (sender.state == .began) { heldPoint.title = "Set Point" heldPoint.subtitle = String(format: "%.4f", coordinates.latitude) + "," + String(format: "%.4f", coordinates.longitude) mapView.addAnnotation(heldPoint) } }extension ViewController: MKMapViewDelegate { func mapView(_ mapView:MKMapView, viewFor annotation: MKAnnotation)-> MKAnnotationView? { if annotation is MKUserLocation { return MKAnnotationView() } else { let annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: "annotationView") ?? MKAnnotationView() annotationView.image = UIImage(named: "place icon") annotationView.canShowCallout = true return annotationView } }I have tried many workarounds as this seems to be a bug...
2
0
1.5k
May ’20
Strange behavior of TimeZone abbreviation in reverse Geocoding...
I am trying to get local times for an event, and I keep getting different time depending on the type of device I am running on, either simulator, or real device. The code: `do {       let placemarks = try await CLGeocoder().reverseGeocodeLocation(location)       if (placemarks.count) > 0 {         let localPlacemark = placemarks.first!         let timeZone = localPlacemark.timeZone!         let tzString = timeZone.abbreviation()         print("Time Zone for \(String(describing: localPlacemark.locality)) is \(tzString )")         return localPlacemark.locality ?? "Unknown Locale"       }       else {         print("Problem with the data received from geocoder")       }     }  On an iPhone 14, the timeZone.abbreviation I get (for the same location) is "EST". But on an iPhone 13, I get "GMT-5", same on an iPhone 8. All three are running iOS 16.2. Has anyone ever seen this? Also, since I am working with a full date during daylight savings time, on the 14 the time returned is correct (DST time), but "isDaylightSavingsTime" always returns false. This makes sense since the abbreviation is "EST" and not "EDT". However, the time returned is correct. On the iPhones 13 mini and 8, the time returned is Standard and not Daylight Savings. This is truly baffling. Any insights, suggestions or help are welcome! Thank you!!
2
0
709
Feb ’23
Once sandbox is set up, cannot go back to XCode testing with config file.
I was testing with XCode (14) and a *.storekit configuration file, and everything was working just fine testing on simulators. Then, I set up a sandbox tester account and was able to test on a device. So far so good. Now, I need to go back to the simulators to test the UI after payment. However, the XCode testing with *.storekit file is not working anymore (even though I loaded the file in the scheme), and every time I try to purchase, it asks for my Apple ID and password, which happens with sandbox, but should not happen with *.storekit option in the scheme. How can I go back to testing In App Purchase (non-consumable) with XCode and the simulators? Thank you!
2
1
664
Mar ’23