Post

Replies

Boosts

Views

Activity

Location Manager init called over 100 times on launch
Hi everyone. I am facing a very weird issue where the Location Manager's init method is being called over 100 times on app launch. I have added a print statement to the class init() and when I filter the results from the log I get a staggering 117 entries just in the first few seconds. Here is my setup: class LocationManager: NSObject, ObservableObject, CLLocationManagerDelegate {     private let locationManager: CLLocationManager     @Published var locationStatus: CLAuthorizationStatus?     @Published var lastLocation: CLLocation?     override init() {         //initial setup for location monitoring         locationManager = CLLocationManager()         locationManager.requestAlwaysAuthorization()                super.init()         locationManager.delegate = self         locationManager.allowsBackgroundLocationUpdates = true         locationManager.activityType = .other         locationManager.pausesLocationUpdatesAutomatically = false         locationManager.desiredAccuracy = kCLLocationAccuracyBest         locationManager.showsBackgroundLocationIndicator = false locationManager.startMonitoringSignificantLocationChanges()         startMonitoringHomeGeofence()         let monitoredRegions = locationManager.monitoredRegions         print("Monitored Regions: \(monitoredRegions.description)")         print(" | Location Monitoring setup complete(This is the line that is printed out so often)")     } } And in my apps main view I initialize the object with: @StateObject var locationManager = LocationManager() I am not sure if this is a real problem, but as this method also initializes the region monitoring which to my knowledge should only be called once on startup and the fact that I get a burst of location updates on my server every time the app launches makes this behavior look like a error in my code, or a bug on apples side. Has anyone got some ideas for me? Take care David
1
0
1.2k
Apr ’22
How can I change the background Color of a navigation view?
I'm currently creating the sidebar for my app and now I am facing the problem of how I can change the background Color of my navigation view without affecting the background of the other views. I've tried it like this: init(){ UITableView.appearance().backgroundColor = UIColor.secondarySystemBackground } That works but now all of my list backgrounds have this color, which a don't want. And if I try it like this, it doesn't change at all: ZStack{     Color.red     List{         VStack{             NavigationLink(destination: ColorMenu()){                 Label("Colors", systemImage: "square.grid.2x2.fill").accentColor(Color("Colory"))             }         }     } } So my question is if there is a way to change the background Color without affecting all the other views? Thanks in advance
4
0
3.6k
Sep ’20
is it possible to have a "floating" window in macCatalyst?
I'm currently developing an app for MacOS using macCatalyst and I now need some way to let users create some kind of sticky notes so that the window is always present. I don't want this functionality on iOS, so there should be some way to create a new window and display a view in it, or is that not possible in macCatalyst? I am using swiftUI and Xcode 12, targeting macOS BigSur. any help would be appreciated 🙃
3
0
2.2k
Aug ’20
Accept CKShare with the SwiftUI lifecycle.
Hi, I want to implement the  func windowScene(_ windowScene: UIWindowScene, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata) method in my SwiftUI lifecycle app. I already used@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate and added the AppDelegate: class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata) {         print("CK Share accepted")     } } Without any success. No "CK Share accepted" in the log. I also tried it with the Scene Delegate and the swift func windowScene(_ windowScene: UIWindowScene, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata) again no luck. I've tried literally everything. The link is working because if I open the share on a sample that uses the UIKit Lifecycle it works correctly. Did I miss anything, or is this a bug with the SwiftUI Lifecycle and UIApplicationDelegateAdaptor? Take care, David
4
0
1.6k
Mar ’21
Xcode and Navigationbar on iOS 14.5
Hi, since iOS 14.5 developer beta the .navigationbarHidden(true) modifier is completely broken. I used the same code on iOS 14.4 and 14.5, on the 14.5 the navigation bar is visible even when using the .navigationbarHidden(true) modifier. 14.4 is working just fine. Anyone else got the same issue? Take care, David
2
0
1.2k
Feb ’21
Error ITMS-90700 when uploading App.
My application always fails to upload due to this Error message: Incorrect Platform. You Included arm64 executable /app name/ in your iOS bundle. The app only targets armv7 devices and all extensions and targets are set to armv7. Just out of curiosity I created a empty Xcode project and without any modifications tried uploading it again. The same result... has anyone got an idea how I could solve that? I am using Xcode 12 and the transporter app to upload because Xcode is not working
2
0
1.1k
Sep ’20