Post

Replies

Boosts

Views

Activity

Reply to ios 12 location bug?
I'm also seeing this issue becoming increasingly common, especially with Complications. I'm working around it like so: func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { if let location = manager.location as CLLocation? { if location.coordinate.latitude == 0 { return } locationManager.stopUpdatingLocation() // do stuff with location } } With the early return, didUpdateLocations might be called multiple times. In my testing, I always get a valid location after a few tries. I've been logging it, and usually didUpdateLocations only gets called twice, but I've seen it up to 5 times, all within the same second, before returning a valid location.
Jan ’22
Reply to Does WK snowfallAmount == Dark Sky precipAccumulation?
Just to clarify, I see https://developer.apple.com/weatherkit/get-started/ says that "precipAccumulation" from Dark Sky maps to "precipitationAmount" in WeatherKit. Is that correct, or are they describing different things? (I'm trying to map WeatherKit into a Dark Sky compatible format, so I want to make sure I'm using the most appropriate data point.) Thank you!
Topic: App & System Services SubTopic: General Tags:
Feb ’23
Reply to WidgetKit memory issues only in iOS 18.3
Ok, I've been able to narrow down the issue and I have a workaround. I'd love to have more detail about the changes that necessitated this in iOS 18.3, but seem to have been reverted in iOS 18.4.  The main fix is adding a new WidgetImage function which downsizes an image like so: func WidgetImage(_ name: String, size: CGFloat) -> Image {     guard let uiImage = UIImage(named: name) else {         Logger.error("WidgetImage missing \(name)")         return Image(systemName: "exclamationmark.triangle")     }     let thumbnailSize = CGSize(width: size, height: size)     guard let thumbnail = uiImage.preparingThumbnail(of: thumbnailSize) else {         Logger.error("WidgetImage thumbnail error \(name)")         return Image(systemName: "exclamationmark.triangle")     }     return Image(uiImage: thumbnail) } Usage example, where previously we would have: Image(icon)     .resizable()     .widgetAccentedRenderingMode(.accented)     .scaledToFit()     .frame(width: 58.0, height: 58.0) ...we update to use WidgetImage: WidgetImage(icon, size: 58.0)     .resizable()     .widgetAccentedRenderingMode(.accented)     .scaledToFit()     .frame(width: 58.0, height: 58.0) Please let me know if there's a better way to handle this, or any other suggestions. Note that we did downsize our images to the 58x58 size, but even resizing them down to 20x20 as we use in some places causes issues. Note also that this workaround fails for images with different light/dark appearance modes. For those cases, we continue using Image() and try to keep the images as small as possible to stay under the memory limit. Thanks!
Apr ’25