I have an app using weatherkit and its currently live and up on the app store, recently I had some users report to me that they had been receiving errors loading weather data, I had error handling built in and it reported an issue with apples authentication server
Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
I have not come across this during the development lifecycle of my project, there where no codebase changes, it just stopped functioning.
The app entitlements are valid and correct, Weatherkit is enabled in both xcode and across my Certs, identifiers and profiles.
I was not experiencing this issue until I reinstalled the app from the app store completly by first removing it and then re-installing fresh.
Hard reboots do not help and I do not want to start suggesting to my users to factory reset their devices.
We are using WeatherKit in both our main app and widget, relying entirely on Apple’s framework for authentication and token management.
We do not generate or inject our own JWT tokens; all token handling is managed by WeatherKit.
We have implemented a debug menu with the following actions:
Clear WeatherKit JWT tokens from the keychain
Clear all related UserDefaults key
Clear all app group data and all UserDefaults.
Perform a “nuclear” cache clear (removes all app data, keychain, and cached files).
We log all WeatherKit fetch attempts and failures, including authentication errors, both in the app and widget and get nothing but code 2.
We have attempted all of the above steps, but continue to experience issues with WeatherKit JWT authentication
We would appreciate any guidance or insight into what else could be causing persistent WeatherKit JWT/authentication issues, or if there are any additional steps we should try.
P.S. - Tested and experiencing the same issues on an iPhone 15 Pro Max and iPhone 15
The Pro Max is on the iOS 26 Beta // and the 15 is on the latest iOS 18
General
RSS for tagDelve into the world of built-in app and system services available to developers. Discuss leveraging these services to enhance your app's functionality and user experience.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello everyone, I think I've discovered a bug in JSONDecoder and I'd like to get a quick sanity-check on this, as well as hopefully some ideas to work around the issue.
When attempting to decode a Decodable struct from JSON using JSONDecoder, the decoder throws an error when it encounters a dictionary that is keyed by an enum and somehow seems to think that the enum is an Array<Any>.
Here's a minimal reproducible example:
let jsonString = """
{
"variations": {
"plural": "tests",
"singular": "test"
}
}
"""
struct Json: Codable {
let variations: [VariationKind: String]
}
enum VariationKind: String, Codable, Hashable {
case plural = "plural"
case singular = "singular"
}
and then the actual decoding:
let json = try JSONDecoder().decode(
Json.self,
from: jsonString.data(using: .utf8)!
)
print(json)
The expected result would of course be the following:
Json(
variations: [
VariationKind.plural: "tests",
VariationKind.singular: "test"
]
)
But the actual result is an error:
Swift.DecodingError.typeMismatch(
Swift.Array<Any>,
Swift.DecodingError.Context(
codingPath: [
CodingKeys(stringValue: "variations", intValue: nil)
],
debugDescription: "Expected to decode Array<Any> but found a dictionary instead.",
underlyingError: nil
)
)
So basically, the JSONDecoder tries to decode Swift.Array<Any> but encounters a dictionary (duh), and I have no idea why this is happening. There are literally no arrays anywhere, neither in the actual JSON string, nor in any of the Codable structs.
Curiously, if I change the dictionary from [VariationKind: String] to [String: String], everything works perfectly.
So something about the enum seems to cause confusion in JSONDecoder. I've tried to fix this by implementing Decodable myself for VariationKind and using a singleValueContainer, but that causes exactly the same error.
Am I crazy, or is that a bug?
We have a subscription WeatherKit app which has been on the App Store since December 2023.
I am getting intermittent JWT auth failures on customer devices. In the great majority of cases, the request succeeds, but sometimes it fails, and sometimes it fails and never recovers. I’m working with a customer right now who is unable to get any weather data at all, and the logs he sends me show
WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors error 2
The app uses the WeatherKit SDK (we are not using the REST API directly). We know we have the project setup as it has been working since launch, and I can verify weatherkit using
security cms -D -i embedded.mobileprovision
It it not a problem with the specific query, since I can get data for the dates and locations they are requesting. I can’t replicate the problem on my test devices.
In case there is a rate limit issue: this app is a bit unusual and downloads an unusual amount of data at once using multiple queries in parallel using a TaskGroup. When the user creates a location, the app downloads a 10 day block of weather (7 days in the past + 3 day forecast) using
WeatherService.shared.weather(
for: location,
including: WeatherQuery.daily(
startDate: startDate,
endDate: endDate
),
WeatherQuery.hourly(
startDate: startDate,
endDate: endDate
)
)
It also downloads about 2 months of daily precipitation data using multiple parallel calls to dailySummary in 10 day blocks:
WeatherService.shared.dailySummary(
for: location,
forDaysIn: DateInterval(start: startDate, end: endDate),
including: .precipitation
)
In almost every case, including on my test devices, this works. But some users get WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors error 2 on every request.
The two users yesterday that had this problem were both on iOS 18.5 for what that's worth, though the app supports 17.2+
Is anyone else seeing this? And can anyone suggest anything else to explore? It's obviously a terrible experience for customers who pay for the service and are unable to get any data.
I did submit this info to Apple as FB18276275
Environment: macOS 15.2 (24C101) with Xcode 16.2 (16C5032a)
Goal: I am trying to build a simple IMKInputController-based input method.
Problem: My .app bundle registers successfully and I can select it as an input source. When selected, it blocks keyboard input, but my handle method does not seem to execute or produce output. I have placed NSLog statements in my controller's init and handle methods.
Code for the controller:
import InputMethodKit
// The IMKTextInput protocol is provided by the framework.
// We don't need to define our own bridging protocol for this test.
public class HelloWorldController: IMKInputController {
public override init!(server: IMKServer!, delegate: Any!, client inputClient: Any!) {
super.init(server: server, delegate: delegate, client: inputClient)
NSLog("HelloWorldIME: Controller has been initialized.")
}
public override func handle(_ event: NSEvent!, client sender: Any!) -> Bool {
NSLog("HelloWorldIME: handle() method was called.")
// ================== FINAL FIX APPLIED HERE ==================
// 1. First, we ensure the client is a fundamental Objective-C object.
guard let clientObject = sender as? NSObject else {
NSLog("HelloWorldIME: Error - client object is not an NSObject.")
return false
}
NSLog("HelloWorldIME: Successfully cast client to NSObject.")
// 2. Now that we have an NSObject, we can safely check if it responds to the selector.
let selector = #selector(IMKTextInput.insertText(_:replacementRange:))
if !clientObject.responds(to: selector) {
NSLog("HelloWorldIME: Error - client object does not respond to the insertText selector.")
return false
}
NSLog("HelloWorldIME: Client responds to insertText. Preparing to insert text.")
// 3. Since we've confirmed it responds, we can now safely treat it as an IMKTextInput
// and call the method.
let client = clientObject as! IMKTextInput
let stringToInsert = "A"
let replacementRange = NSRange(location: NSNotFound, length: 0)
client.insertText(stringToInsert, replacementRange: replacementRange)
NSLog("HelloWorldIME: Called insertText with string '\(stringToInsert)'. Action complete.")
// ========================================================
return true
}
}
Hi,
My app is going to consist of 2-3 pages of weather data. Do I have to add the Apple Weather logo to each page, or just the main one?
Thanks,
Dan Uff
All of my apps stopped working with WeatherKit this morning. They all return an "Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2" error.
I am certain that the WeatherKit capability added (in project) and enabled as a Capability & App Service (on developer portal for the identifier). All other iCloud features of my apps are working as expected. I have also done all the normal troubleshooting using codesign / security cms, etc. to verify entitlements.
I created the following simple project to verify the integration.
import WeatherKit
import CoreLocation
struct ContentView: View {
@State private var temp: Measurement<UnitTemperature>? = nil
var body: some View {
VStack {
if let t = temp {
Text("\(t.value.rounded())°\(t.unit.symbol)")
} else {
Text("Fetching…")
.task {
let service = WeatherService()
do {
let location = CLLocation(latitude: 50.318668, longitude: -114.917710)
let weather = try await service.weather(for: location, including: .current)
temp = weather.temperature
} catch {
print("Error:", error)
}
}
}
}
}
}
Any ideas what may be happening?
I have a SwiftUI document-based app that for the sake of this discussion stores accounting information: chart of accounts, transactions, etc. Each document is backed by a SwiftData DB.
I'd like to incorporate search into the app so that users can find transactions matching certain criteria, so I went to Core Spotlight. Indexing & search within the app seem to work well.
The issue is that Spotlight APIs appear to be App based & not Document based. I can't find a way to separate Spotlight data by document.
I've tried having each document maintain a UUID as a document-specific identifier and include the identifier in every CSSearchableItem. When performing a query I filter the results with CSUserQueryContext.filterQueries that filter by the document identifier. That works to limit results to the specific file for search operations.
Index updates via CSSearchableIndexDelegate.reindex* methods seem to be App-centric. A user may have file #1 open, but the delegate is being asked to update CSSearchableItems for IDs in other files.
Is there a proper way to use Spotlight for in-app search with a document-based app?
Is there a way to keep Spotlight-indexed data local within the app & not make it available across the system? I.e. I'd like to search within the app only. System-level searches should not surface this data.
I just adding a way to donate my app's data to Core Spotlight using CSSearchableIndex, but I'm finding that spotlight is only searching for the title of the CSSearchableItem I create. I know the index is working, because it always finds the item through the title property, but nothing else.
This is how I'm creating the CSSearchableItem:
- (CSSearchableItem *) createSearchableItem {
CSSearchableItemAttributeSet* attributeSet = [[CSSearchableItemAttributeSet alloc] initWithContentType: UTTypeText];
attributeSet.title = [self titleForIndex];
attributeSet.displayName = [self titleForIndex];
attributeSet.contentDescription = [self contentDescriptionForIndex];
attributeSet.thumbnailData = [self thumbnailDataForIndex];
attributeSet.textContent = [self contentDescriptionForIndex];
CSSearchableItem *item = [[CSSearchableItem alloc] initWithUniqueIdentifier: [self referenceURLString] domainIdentifier:@"com.cjournal.cjournal-Logs" attributeSet:attributeSet];
item.expirationDate = [NSDate distantFuture];
return item;
}
There's a lot of confusing tips around which say specifying the 'textContent' should work, and/or setting the displayName is essential, but none of these are working.
Is there something I'm missing with my setup?
Thanks.
We have an application which is written in Swift, which activates Transparent Proxy network extension. We are using Jamf MDM profile for deployment.
To avoid the user deleting / disabling the extension from General -> LogIn Items & Extension -> Network Extensions screen, we are using "Non-removable system extensions from UI" attribute under Allowed System Extensions and Teams IDs section.
In new Mac OS 26 (Tahoe), user can also enable/disable the extension from General -> LogIn Items & Extension -> Apps tab. The "Non-removable system extensions from UI" attribute set in Jamf MDM profile does not apply to this tab.
Same attribute is working for General -> LogIn Items & Extension -> Extensions tab and there the slider is greyed out and Remove option is not available under more menu.
Is there any new key/configuration defined to disable the slider from General -> LogIn Items & Extension -> Apps tab?
Created https://feedbackassistant.apple.com/feedback/18198031 - FB18198031 feedback assistant ticket as well.
Topic:
App & System Services
SubTopic:
General
Tags:
Network Extension
System Extensions
Device Management
Could someone please explain how to use a custom sound when setting up an alarm using AlarmKit? It keeps playing a default sound.
Also, I keep having an issue where the alarm sound plays but doesn’t show the alarm interface buttons unless the screen is locked.
Topic:
App & System Services
SubTopic:
General
Hi All, I’m puzzled by this issue: my app uses WeatherKit to fetch hourly UV-index and temperature forecasts. The same build, running on the latest iOS, succeeds on most devices but consistently fails on a few. Strangely, the paired Apple Watch version retrieves the data without problems. Could WeatherKit be applying per-user throttling? Any insight would be greatly appreciated.
How to programmatically check if ApplicationToken or ActivityCategoryToken is expired in FamilyActivityPicker?
I'm building a Screen Time-based parental control app using FamilyControls and ManagedSettings. We use FamilyActivityPicker to allow the user to select apps and categories to restrict, and we apply the shield using:
store.shield.applications = .specific(selection.applicationTokens)
store.shield.applicationCategories = .specific(selection.categoryTokens)
Sometimes, we observe that the shield silently fails to apply — no error is thrown, but the restrictions aren't enforced. I suspect this may be due to expired or invalid tokens, possibly if the app was removed or the selection became stale.
My Questions:
Can ApplicationToken or ActivityCategoryToken expire or become invalid over time?
If yes, is there a supported or recommended way to detect whether a token is still valid before applying it to the shield?
Is comparing the current shield values (store.shield.applications and store.shield.applicationCategories) after applying them a reliable validation method?
What's the best practice to handle expired tokens (e.g. re-prompt the FamilyActivityPicker, or show a fallback)?
What Is the Expiration Duration of Tokens from FamilyActivityPicker?
Any guidance or insight from the Screen Time/FamilyControls team would be greatly appreciated!
Thank you!
How to use wifi-aware to connect third-party device with iPhone?
The document mention that "Your app can use the Wi-Fi Aware framework to connect with Wi-Fi Aware certified accessories", but How to be Wi-Fi Aware certified accessories?
it there any detail?
Topic:
App & System Services
SubTopic:
General
I have installed the macOS 26 WWDC beta on a secondary volume, and set it up with two user accounts (both administrators).
However, the options for switching users without fully logging out are nowhere to be found.
The topic is still included in macOS Help and is shown when searching for “fast” in System Settings, however, the option is hidden/missing in the pref pane when selected.
Filed FB18155517 (macOS 26 beta: No Fast User Switching?)
I have hosted my AASA file in https://powerbrowser.app/.well-known/apple-app-site-association in signed format as per documentation.
I still can not see open in app button when open a link by long press.
By the way i have activated 'Associated Domains' and put proper entitlements as per documantation.
Hi I'm trying to build a screen time app and the Apple docs and APIs really leave something to be desired. I want to block apps on a schedule. That's it. To do this I need my DeviceActivityMonitorExt to know which apps to block. I need to somehow pass a DeviceActivitySelection from the main app into this DeviceActivityMonitorExt. How can I do this?
How can I use the Screen Time API to set a restriction for a child account from my app running on the parent’s account?
I’m creating an app with the Screen Time API and I would like to know how to make the app show a parental control editing view for parents and a view for child accounts that shows which apps are blocked. How can I do this?
Is there any way to use the screen time API on Mac?
Hey folks!
I'm working on a macOS app which has a Finder Quick Action extension. It's all working fine, but I'm hitting a weird struggle with getting the icon rendering how I would like, and the docs haven't been able to help me.
I want to re-use a custom SF Symbol from my app, so I've copied that from the main app's xcassets bundle to the one in the extension, and configured it for Template rendering.
The icon renders in the right click menu in Finder, the Finder preview pane and the Extensions section of System Settings, but all of them render with the wrong colour in dark mode. In light mode they look fine, but in dark mode I would expect a templated icon to be rendered in white, not black.
I've attached a variety of screenshots of the icons in the UI and how things are set up in Xcode (both for the symbol in the xcassets bundle, and the Info.plist)
I tried reading the docs, searching Google, searching GitHub and even asking the dreaded AI, but it seems like there's not really very much information available about doing icons for Finder extensions, especially ones using a custom SF Symbol, so I would love to know if anyone here has been able to solve this in the past!
Finder preview pane in light mode:
Finder preview pane in dark mode:
Finder quick action context menu:
System Settings extension preferences:
The custom symbol in my .xcassets bundle:
The finder extension's Info.plist: