Posts

Post not yet marked as solved
4 Replies
1.1k Views
I'm porting my iPhone/iPad App to Mac Catalyst. First time I ran it got "Use Location while in use" pop up, gave consent. Next time I ran it - the consent is saved which is OK. I want to delete all settings and test from scratch. Deleted the folder in Library/Containers, derived data folder. But these settings are stored somewhere else. Where are they stored?  
Posted Last updated
.
Post not yet marked as solved
1 Replies
3.3k Views
I want to use SwiftUI to display a map and handle touch on the map. Here is my code so far. I have a problem integrating GestureRecognizer in Coordinator specifically accessing self.mapView inside it.Also adding addGestureRecognizer. How to do that?=======================================//// ContentView.swiftimport SwiftUIimport Gomobiletidbstruct ContentView: View { var body: some View { VStack { MapView() .edgesIgnoringSafeArea(.vertical) Text("Turtle Rock") .font(.title) .padding(.leading, 15) .padding(.top, 5) .textFieldStyle(RoundedBorderTextFieldStyle()) VStack { HStack { Text("Joshua Tree National Park") .font(.subheadline) Spacer() Text("California") .font(.subheadline) } .padding() } }}=======================================//// MapView.swiftimport SwiftUIimport MapKitstruct MapView: UIViewRepresentable { func makeCoordinator() -> Coordinator { Coordinator(self) } final class Coordinator: NSObject, MKMapViewDelegate { var control: MapView init(_ control: MapView) { self.control = control longPressGestureRecognizer = UILongPressGestureRecognizer(target: self.control, action: #selector(Coordinator.mapViewLongTapRecognizer(gestureRecognizer:))) control.addGestureRecognizer(longPressGestureRecognizer) } @objc func mapViewLongTapRecognizer( gestureRecognizer: UILongPressGestureRecognizer) { if (gestureRecognizer == longPressGestureRecognizer){ if (gestureRecognizer.numberOfTouchesRequired == 1){ if gestureRecognizer.state == UIGestureRecognizer.State.began { let touchPoint: CGPoint = gestureRecognizer.location(in: self.mapView) } } } } // MARK: - MKMapViewDelegate func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer { let renderer = MKOverlayPathRenderer() return renderer } func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? { return annotation as? MKAnnotationView } } func makeUIView(context: Context) -> MKMapView { let mapView = MKMapView(frame: .zero) mapView.delegate = context.coordinator mapView.mapType = .hybrid mapView.showsCompass = true mapView.showsUserLocation = true mapView.showsBuildings = true return mapView } func updateUIView(_ mapView: MKMapView, context: Context) { longPressGestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(Coordinator.mapViewLongTapRecognizer(gestureRecognizer:))) mapView.addGestureRecognizer(longPressGestureRecognizer) let span = MKCoordinateSpan(latitudeDelta: 2.0, longitudeDelta: 2.0) let region = MKCoordinateRegion(center: currentLocation.coordinate, span: span) mapView.setRegion(region, animated: true) }}struct MapView_Preview: PreviewProvider { static var previews: some View { MapView() }}=======================================
Posted Last updated
.
Post not yet marked as solved
1 Replies
831 Views
I followed the instructions in: Determining Service Entitlement on the Server https://developer.apple.com/documentation/storekit/in-app_purchase/subscriptions_and_offers/determining_service_entitlement_on_the_server Running the following: curl -XPOST -H "Content-type: application/json" -d 'simulateExamples/flatJsonExample.json' 'localhost:3000/simulate' got the error: node ./bin/www POST /simulate 400 8.436 ms - 1276 SyntaxError: Unexpected token s in JSON at position 0 I validated flatJsonExample.json with lint and it was OK.
Posted Last updated
.