I'm experiencing a crash during a lightweight Core Data migration when a widget that accesses the same database is installed. The migration fails with the following error:
CoreData: error: addPersistentStoreWithType:configuration:URL:options:error: returned error NSCocoaErrorDomain (134100)
error: userInfo:
CoreData: error: userInfo:
error: metadata : {
NSPersistenceFrameworkVersion = 1414;
NSStoreModelVersionChecksumKey = "dY78fBnnOm7gYtb+QT14GVGuEmVlvFSYrb9lWAOMCTs=";
NSStoreModelVersionHashes = {
Entity1 = { ... };
Entity2 = { ... };
Entity3 = { ... };
Entity4 = { ... };
Entity5 = { ... };
};
NSStoreModelVersionHashesDigest = "aOalpc6zSzr/VpduXuWLT8MLQFxSY4kHlBo/nuX0TVQ/EZ+MJ8ye76KYeSfmZStM38VkyeyiIPf4XHQTMZiH5g==";
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
""
);
NSStoreType = SQLite;
NSStoreUUID = "9AAA7AB7-18D4-4DE4-9B54-893D08FA7FC4";
"_NSAutoVacuumLevel" = 2;
}
The issue occurs only when the widget is installed. If I remove the widget’s access to the Core Data store, the migration completes successfully. The crash happens only once—after the app is restarted, everything works fine.
This occurs even though I'm using lightweight migration, which should not require manual intervention. My suspicion is that simultaneous access to the Core Data store by both the main app and the widget during migration might be causing the issue.
Has anyone encountered a similar issue? Is there a recommended way to ensure safe migration while still allowing the widget to access Core Data?
Any insights or recommendations would be greatly appreciated.
WidgetKit
RSS for tagShow relevant, glanceable content from your app on iOS and iPadOS Home Screen and Lock Screen, macOS Desktop, Apple Watch Smart Stack and Complications, and in StandBy mode on iPhone.
Posts under WidgetKit tag
200 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi there,
This is my first time posting here. I'm working on small projects on Swift and SwiftUI now and then. I'm currently trying to develop an application that gets some bus arrival data using API and displaying them with live activities. The thing is that I'm not quite sure how frequently updates work yet. Still trying to figure out if I can update the live activity everytime the data coming right from the API changes or use push notification updates each minute passing by, but that is another thread that I'm going to focus with more details.
Everytime i'm trying to deploy my app on my iphone or a simulator this error keeps popping up and I can't figure out why.
Any ideas? Let me know if you need any snippet of my code.
SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 "Failed to show Widget 'com.gregorikouk.MapKitTut.BusWidgetKit' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0xb1282dfe0 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)}}, FBSOpenApplicationRequestID=0xe5da, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}." UserInfo={NSLocalizedDescription=Failed to show Widget 'com.gregorikouk.MapKitTut.BusWidgetKit' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0xb1282dfe0 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)}}, FBSOpenApplicationRequestID=0xe5da, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}., NSUnderlyingError=0xb1281d830 {Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0xb1282dfe0 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)}}, FBSOpenApplicationRequestID=0xe5da, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}}}
Domain: DTXMessage
Code: 1
User Info: {
DVTErrorCreationDateKey = "2023-10-02 21:06:04 +0000";
}
--
System Information
macOS Version 14.0 (Build 23A344)
Xcode 15.0 (22265) (Build 15A240d)
Timestamp: 2023-10-03T00:06:04+03:00
Topic:
App & System Services
SubTopic:
Notifications
Tags:
APNS
Notification Center
WidgetKit
ActivityKit
My app’s widget is not displaying correctly and only shows a blank white screen.
My app features two kinds of widgets, let's call them kind A and kind B.
I have both A and B widgets on my Home Screen. When I tap the button on widget A (associated with App Intent), I expect widget B to also reload.
However, if you call WidgetCenter.shared.reloadAllTimelines() inside the perform() method of the AppIntent, the timeline of widget B does not reload immediately. This issue only occurs on a physical device and is not consistently reproducible. On a simulator, however, widget B reloads as expected.
FB13152293
So I have a MacOS application that was working just fine before Xcode 16. The Widgets are not working anymore.
The main application and the widgets share a file in a common App Group.
The widget app now get a permission error when accessing the file.
Also, the Widget Kit simulator keeps crashing.
I also try to start a new project in Xcode, add a target with a Widget extension with an App Intent and run it, and it also crashes.
Sometimes, it doesn't crash but just display the error: "Failed to load widget. The operation couldn't be completed. (WidgetKit_Simulator.WidgetDocument.Error error 2.).
Edited to attach WidgetKit error log
widgetKitError.txt
In my Watch app on watchOS 9 I was using .foregroundColor(myColour) to colour the text in a widgetLabel on a corner complication like this:
let myColour: Color = functionThatReturnsAColorObjectConstructedLike Color.init(...) // green
.widgetLabel {
Text(myText)
.foregroundColor(myColour)
}
It worked fine; the widget label was green.
Now, in watchOS 10, I see that foregroundColor() is being deprecated in favour of foregroundStyle(), and I can use .foregroundStyle(.green), and - importantly - foregroundStyle() is only available on watchOS 10 and newer.
myColour is calculated depending on some other info, so I can't just write .green, and when I use .foregroundStyle(myColour) the widget label comes out as white every time, even if I set myColour = .green.
I think I have to use some sort of extension to pick the right combination, something like:
extension View {
func foregroundType(colour: Colour, style: any ShapeStyle) -> some THING? {
if #available(watchOS 10.0, *) {
return foregroundStyle(style)
} else {
return foregroundColor(colour)
}
}
}
// Usage
let myStyle: any ShapeStyle = SOMETHING?
...
.widgetLabel {
Text(myText)
.foregroundType(colour: myColour, style: myStyle)
It doesn't work. I just can't figure out what should be returned, nor how to return it. Any ideas?
I'm trying to setup a widget to pull an image down from a webserver and I'm running into an error of Widget archival failed due to image being too large [9] - (1024, 1024), totalArea: 1048576 > max[718080.000000].
I've tried two different approaches to resolve this error and both have failed to resolve the image.
I've also confirmed that I'm getting the image in the AppIntentTimelineProvider.
private func getImageUI(urlString: String) -> UIImage? {
guard let url = URL(string: urlString) else { return nil }
guard let imageData = try? Data(contentsOf: url) else { return nil }
return UIImage(data: imageData)?.resizedForWidget()
}
Is there another approach I could take on addressing this issue so the image appears on the widget?
Simple approach
extension UIImage {
func resized(toWidth width: CGFloat, isOpaque: Bool = true) -> UIImage? {
let canvas = CGSize(width: width, height: CGFloat(ceil(width/size.width * size.height)))
let format = imageRendererFormat
format.opaque = isOpaque
return UIGraphicsImageRenderer(size: canvas, format: format).image {
_ in draw(in: CGRect(origin: .zero, size: canvas))
}
}
}
extension UIImage {
/// Resize the image to strictly fit within WidgetKit’s max allowed pixel area (718,080 pixels)
func resizedForWidget(maxArea: CGFloat = 718_080.0, isOpaque: Bool = true) -> UIImage? {
let originalWidth = size.width
let originalHeight = size.height
let originalArea = originalWidth * originalHeight
print("🔍 Original Image Size: \(originalWidth)x\(originalHeight) → Total Pixels: \(originalArea)")
// ✅ If the image is already within the limit, return as is
if originalArea <= maxArea {
print("✅ Image is already within the allowed area.")
return self
}
// 🔄 Calculate the exact scale factor to fit within maxArea
let scaleFactor = sqrt(maxArea / originalArea)
let newWidth = floor(originalWidth * scaleFactor) // Use `floor` to ensure area is always within limits
let newHeight = floor(originalHeight * scaleFactor)
let newSize = CGSize(width: newWidth, height: newHeight)
print("🛠 Resizing Image: \(originalWidth)x\(originalHeight) → \(newWidth)x\(newHeight)")
// ✅ Force bitmap rendering to ensure the resized image is properly stored
let format = UIGraphicsImageRendererFormat()
format.opaque = isOpaque
format.scale = 1 // Ensures we are not letting UIKit auto-scale it back up
let renderer = UIGraphicsImageRenderer(size: newSize, format: format)
let resizedImage = renderer.image { _ in
self.draw(in: CGRect(origin: .zero, size: newSize))
}
print("✅ Final Resized Image Size: \(resizedImage.size), Total Pixels: \(resizedImage.size.width * resizedImage.size.height)")
return resizedImage
}
}
These are logs from a failed image render if that helps
🔍 Original Image Size: 720.0x1280.0 → Total Pixels: 921600.0
🛠 Resizing Image: 720.0x1280.0 → 635.0x1129.0
✅ Final Resized Image Size: (635.0, 1129.0), Total Pixels: 716915.0
Xcode 16.2 are unavailable to develop widget with dynamic options, no matter SiriIntent or AppIntent that I try to use.
I have try to start a complete new project, then add widget with app intent checkbox check, with zero code changed then i press command run and WidgetKit Simulator present CHSErrorDomain error 1103 always, if i try to add widget directly from desktop, dynamic options are available to select but widgets doesn't seem like load successfully, it is stuck same in the WidgetKit Simulator.
I also try to start a new project in my other MacBook but no luck, this error are presenting all the time, I'm totally stuck here, does anybody having this issue?
We have recently added WidgetKit widgets to an existing product, and they've been working great on Macs using Big Sur and later. Recently, when installing a build on a Montery Mac, the widgets were no longer in Notification Center. After some trial and error, we discovered that if we build the project with Xcode 15.4, the widgets appear, but if we build with Xcode 16, the widgets vanish. This seems to happen on Macs running Big Sur or Monterey. The project is being built on Macs running Sonoma (both Apple Silicon and Intel).
Is there a build setting in Xcode 16 that may have this effect?
在执行完 INIntent 或者AppIntent的Shortcuts后,刷新 WidgetKit桌面小组件
I had write a widget after iOS 17+, It had a Toggle to perform a appintent .
When switch the toggle, the appintent will perfrom , just like
`
func perfrom() async throws -> some IntentResult {
// first
let first = try await getFristValue()
let second = try await getSecondValue(by: first)
let third = try awiat getThirdValue(by: second)
return .result()
}
`
and I found, it will work when I am debugging connect with Xcode.
But, when I don't connect xcode, it will not work.
How can I fixed it ?
not sure where to post this hence adding here.
how to run in this full screen mode even when the screen is locked. As far as I looked, it’s only live activities that the developers are made available with. Is there a way to create our own UI on lockscreen, given a similar usecase exists?
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Inter-process communication
WidgetKit
App Intents
ActivityKit
How to execute code on main app when interacted with a live activity, given that they are already interactable.
is there a way without opening the app?
what are the best ways?
Topic:
App & System Services
SubTopic:
Processes & Concurrency
Tags:
Extensions
WidgetKit
ActivityKit
In the past it was possible to use the Today Extensions to do some background processing without having the unlock the phone. This was extremely useful for application, but now with the current WidgetKit we face the problem of sometimes having to enter the lock screen code if face Id fails, or is not available.
With the Today Extension, we were able to initiate a location request and send an HTTP request. Is there any way to get a similar request chain across on the latest OS? Maybe there is something out of the box that we are not thinking of.
Our application is highly time sensitive and in the field the lock screen delay can be a big problem and put a users safety at risk, so this is why I ask.
I want to add a widget to my app that will display the # of pickups the user has for the day. I have the DeviceActivityReport working in the main app but can't get it to display in the widget since it is not a supported view for widgets. Is there any workaround for getting this view to the widget?
I tried converting the DeviceActivityReport view to a UI image thinking maybe that would be a way to use a widget approved view type but ImageRenderer seems to fail to render an image for the view (which is just a Text view).
To summarize my questions:
Is it possible to display a DeviceActivityReport in a widget? If so, what is the best practice?
Is converting the DeviceActivityReport view into an image and displaying that in a widget an option?
Here's my attempt to convert the DeviceActivityReport view into a UIImage:
import SwiftUI
import _DeviceActivity_SwiftUI
struct PickupsDeviceActivityReport: View {
@State private var context: DeviceActivityReport.Context = .totalActivity
@State private var renderedImage = Image(systemName: "exclamationmark.triangle")
@Environment(\.displayScale) var displayScale
var body: some View {
renderedImage
.onAppear { render() }
.onChange(of: context) {
_ in render()
}
}
@MainActor func render() {
let renderer = ImageRenderer(content: DeviceActivityReport(context))
renderer.scale = displayScale
if let uiImage = renderer.uiImage {
renderedImage = Image(uiImage: uiImage)
}
}
}
Help is appreciated. Thank you.
After updating to watchOS 11.1, updates using WidgetCenter.shared.reloadAllTimelines() in WKRefreshBackgroundTask stopped working. When the background task is triggered, it gets data from the phone and updates the WidgetKit complications. But now the refresh call WidgetCenter.shared.reloadAllTimelines() does not update the complications.
Some of our users keep reporting that occasionally some widgets (which initially were working perfectly) are now broken and show only skeletons.
Note that the app has multiple widgets, and this happens only to some of them (that is when some widgets get broken, some other widgets are still working normally).
While developing the app, I came across this symptom as well, and when I read the device console, I found the following errors in the console (which the system was repeatedly reporting to the console):
Unable to get connection interface: Error Domain=LNConnectionErrorDomain Code=1100 "Unable to locate com.example.app.MyAppntents for the com.apple.intents-service extension point" UserInfo={NSLocalizedDescription=Unable to locate com.example.app.MyAppIntents for the com.apple.intents-service extension point}
The affected widgets use the 'UserDefaults with groups' to read the data that is stored by the host app. And I think that sometimes the widget fails (or even crashes) while reading the data from the UserDefaults and it ends up showing the skeleton.
The only remedy I found was
Uninstall the app
Reboot the device
Install the app again.
After this, the widget starts to work again..
So, what can be the reason behind this? Is this an iOS bug or what and how to fight it?
I am trying to create a lockscreen widget that is a deepink to a page in my app, but I am getting an error once building the widget itself (building the app works). Currently, the app is on my phone as well as the widget on my lockscreen, but the widget only goes to either my homepage or the page I was last on if the app wasn't fully closed.
I've been stuck on this feature and can't get any progress on getting it to work properly...
The error:
SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 "Failed to show Widget '.widget' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x7fea68510 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=3 "Request widget family (systemMedium) is not supported by this widget kind (TransactionLockScreenWidget)" UserInfo={NSLocalizedDescription=Request widget family (systemMedium) is not supported by this widget kind (TransactionLockScreenWidget)}}, FBSOpenApplicationRequestID=0x8b49, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}." UserInfo={NSLocalizedDescription=Failed to show Widget '.widget' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x7fea68510 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=3 "Request widget family (systemMedium) is not supported by this widget kind (TransactionLockScreenWidget)" UserInfo={NSLocalizedDescription=Request widget family (systemMedium) is not supported by this widget kind (TransactionLockScreenWidget)}}, FBSOpenApplicationRequestID=0x8b49, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}., NSUnderlyingError=0x7fea68540 {Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x7fea68510 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=3 "Request widget family (systemMedium) is not supported by this widget kind (TransactionLockScreenWidget)" UserInfo={NSLocalizedDescription=Request widget family (systemMedium) is not supported by this widget kind (TransactionLockScreenWidget)}}, FBSOpenApplicationRequestID=0x8b49, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}}}
Domain: DTXMessage
Code: 1
User Info: {
DVTErrorCreationDateKey = "2025-01-14 01:35:08 +0000";
}
SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 "Failed to show Widget '.widget' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x7fea68510 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=3 "Request widget family (systemMedium) is not supported by this widget kind (TransactionLockScreenWidget)" UserInfo={NSLocalizedDescription=Request widget family (systemMedium) is not supported by this widget kind (TransactionLockScreenWidget)}}, FBSOpenApplicationRequestID=0x8b49, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}." UserInfo={NSLocalizedDescription=Failed to show Widget '.widget' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x7fea68510 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=3 "Request widget family (systemMedium) is not supported by this widget kind (TransactionLockScreenWidget)" UserInfo={NSLocalizedDescription=Request widget family (systemMedium) is not supported by this widget kind (TransactionLockScreenWidget)}}, FBSOpenApplicationRequestID=0x8b49, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}., NSUnderlyingError=0x7fea68540 {Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x7fea68510 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=3 "Request widget family (systemMedium) is not supported by this widget kind (TransactionLockScreenWidget)" UserInfo={NSLocalizedDescription=Request widget family (systemMedium) is not supported by this widget kind (TransactionLockScreenWidget)}}, FBSOpenApplicationRequestID=0x8b49, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}}}
Domain: DTXMessage
Code: 1
System Information
macOS Version 15.2 (Build 24C101)
Xcode 16.2 (23507) (Build 16C5032a)
Timestamp: 2025-01-13T19:35:08-06:00
struct DeployAndWithdrawDefensesAppIntent: WidgetConfigurationIntent {
// An example configurable parameter.
@Parameter(title:LocalizedStringResource("ax_alarm_device_name"))
}
In the process of using iOS widgetKit development team a, configuration item title need language internationalization (@ Parameter (title: LocalizedStringResource (" ax_alarm_device_name "))),
but found no effect. I first changed the language of the system on the iphone and found that the widget worked. However, just changing the language of the app did not take effect. Is there any way to just change the app language and make the widgets change? Thank you very much!
Hello everyone,
I have an app leveraging SwiftData, App Intents, Interactive Widgets, and a Control Center Widget. I recently added Live Activity support, and I’m using an App Intent to trigger the activity whenever the model changes.
When the App Intent is called from within the app, the Live Activity is created successfully and appears on both the Lock Screen and in the Dynamic Island. However, if the same App Intent is invoked from a widget, the model is updated as expected, but no Live Activity is started.
Here’s the relevant code snippet where I call the Live Activity:
`
await LiveActivityManager.shared.newSessionActivity(session: session)
And here’s how my attribute is defined:
struct ContentState: Codable, Hashable {
var session: Session
}
}
Is there any known limitation or workaround for triggering a Live Activity when the App Intent is initiated from a widget? Any guidance or best practices would be greatly appreciated.
Thank you!
David