WidgetKit

RSS for tag

Show 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
Sort by:

Post

Replies

Boosts

Views

Activity

openAppWhenRun makes AppIntent crash when launched from Control Center.
Adding the openAppWhenRun property to an AppIntent for a ControlWidgetButton causes the following error when the control is tapped in Control Center: Unknown NSError The operation couldn’t be completed. (LNActionExecutorErrorDomain error 2018.) Here’s the full ControlWidget and AppIntent code that causes the errorerror: Should controls be able to open apps after the AppIntent runs, or is this a bug?
0
0
32
11h
macOS Widgets won't launch with app group set
i'm working on an app which shares a swiftdata database between the main app and its widgets. prior to the sequoia/xcode 16 betas this was working fine with setting the same app group for app & widget targets. however, now whenever i try to run my main app from Xcode i get a user permission requestor saying " would like to access data from other apps.". this happens every time i run it. whenever the widget is started (via trying to place it on the desktop, or the widgetkit simulator etc) it exits immediately (i assume because it can't show the permission requestor?) if i disable the app group for the widget, it runs.. however, of course, i can't access the main app's database. i'm on sequoia beta 2 (24A5279h) and Xcode 16 beta 2 (16A5171r) note: while the widgetkit simulator is now present in sequoia beta 2, i haven't actually been able to successfully use it
2
1
61
1d
How often should getTimeline be called in widgetkit?
Hi, I am implementing a widget where I make some network calls. I have set the timelineprovider to update on end, and I have about an hour of widgetkit entries going for each timeline. I notice that the getTimeline function is called an arbitrary amount of times, usually between 2-5 when my widget fetches new entries for the widget. I was under the impression that it should only call the getTimeline function once, and use the entires for all of my widgets (I 3 widgets in total, two for the lock screen and one for home screen). Am I missing something when it comes to understanding the basic lifecycle? Anyone else having these issues? I am using XCode 15.3 and developing for iOS 17.
1
0
64
1d
Crash in Widget extension
Hi everyone! I'm seeking help to understand crashes that, as I can see, come from the widget extension. The brief stack trace that I can see under Xcode -> Window -> Organizer -> [My App] -> Crashes is pretty short (see attachment). My widgets do fetch request to Core Data, but the operation is performed on the background thread and data is lightweight. I have been debugging for days, but haven't found any weak code blocks that might take too much memory or crash due to simple language issues. Will appreciate any help! In the crash report file, I see the following logs (highlight a few of them due to lines limit): Incident Identifier: 62A28083-43EE-47F2-A2E0-89A1FA89744A Hardware Model: iPhone13,2 Process: MyAppWidgetsExtension [28359] Identifier: MyAppWidgets Version: 2.16.0 (290) OS Version: iPhone OS 17.4.1 (21E236) Exception Type: EXC_CRASH (SIGKILL) Termination Reason: RUNNINGBOARD 0xdead10cc Thread 0 Crashed: 0 libsystem_kernel.dylib 0x00000001e05c5af8 mach_msg2_trap + 8 (:-1) 1 libsystem_kernel.dylib 0x00000001e05c5890 mach_msg2_internal + 80 (mach_msg.c:201) 2 libsystem_kernel.dylib 0x00000001e05c57a8 mach_msg_overwrite + 436 (mach_msg.c:0) 3 libsystem_kernel.dylib 0x00000001e05c55e8 mach_msg + 24 (mach_msg.c:323) 4 CoreFoundation 0x00000001980a001c __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2624) 5 CoreFoundation 0x000000019809df04 __CFRunLoopRun + 1208 (CFRunLoop.c:3007) 6 CoreFoundation 0x000000019809d968 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420) 7 Foundation 0x0000000196f2c4a8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373) 8 Foundation 0x0000000196f2aff0 -[NSRunLoop(NSRunLoop) run] + 64 (NSRunLoop.m:398) 9 libxpc.dylib 0x00000001f40aa26c _xpc_objc_main + 336 (main.m:267) 10 libxpc.dylib 0x00000001f40ac7e4 _xpc_main + 64 (init.c:1294) 11 libxpc.dylib 0x00000001f40ac7a4 xpc_bs_main + 16 (init.c:1310) 12 BoardServices 0x00000001b0d38240 +[BSServicesConfiguration activateXPCService] + 68 (BSServicesConfiguration.m:113) 13 ExtensionFoundation 0x00000001a70bbdf0 -[_EXRunningExtension resume] + 260 (EXRunningExtension.m:298) 14 ExtensionFoundation 0x00000001a70bbc38 -[_EXRunningExtension startWithArguments:count:] + 396 (EXRunningExtension.m:269) 15 ExtensionFoundation 0x00000001a70cfa30 EXExtensionMain + 220 (EXExtensionMain.m:34) 16 Foundation 0x0000000197665ed4 NSExtensionMain + 204 (NSExtensionMain.m:21) 17 dyld 0x00000001bb5bed84 start + 2240 (dyldMain.cpp:1298) Thread 2: 0 libsystem_kernel.dylib 0x00000001e05d381c guarded_pwrite_np + 8 (:-1) 1 libsqlite3.dylib 0x00000001c1ddc158 seekAndWrite + 456 (sqlite3.c:44255) 2 libsqlite3.dylib 0x00000001c1d95908 unixWrite + 180 (sqlite3.c:44333) 3 libsqlite3.dylib 0x00000001c1de4574 pagerWalFrames + 868 (sqlite3.c:66940) 4 libsqlite3.dylib 0x00000001c1d95628 sqlite3PagerCommitPhaseOne + 316 (sqlite3.c:70256) 5 libsqlite3.dylib 0x00000001c1d85d7c sqlite3BtreeCommitPhaseOne + 172 (sqlite3.c:80934) 6 libsqlite3.dylib 0x00000001c1d85944 vdbeCommit + 1136 (sqlite3.c:93952) 7 libsqlite3.dylib 0x00000001c1d5ec74 sqlite3VdbeHalt + 1352 (sqlite3.c:94362) 8 libsqlite3.dylib 0x00000001c1d7fd04 sqlite3VdbeExec + 42952 (sqlite3.c:103728) 9 libsqlite3.dylib 0x00000001c1d74c80 sqlite3_step + 964 (sqlite3.c:97699) 10 CoreData 0x00000001a01ba0e0 _execute + 128 (NSSQLiteConnection.m:4573) 11 CoreData 0x00000001a01e5510 -[NSSQLiteConnection commitTransaction] + 596 (NSSQLiteConnection.m:3250) 12 CoreData 0x00000001a040aac0 _executeBatchUpdateRequest + 1216 (NSSQLCore_Functions.m:1110) 13 CoreData 0x00000001a030a240 -[NSSQLBatchUpdateRequestContext executeRequestCore:] + 32 (NSSQLBatchUpdateRequestContext.m:88) 14 CoreData 0x00000001a01c8508 -[NSSQLStoreRequestContext executeRequestUsingConnection:] + 252 (NSSQLStoreRequestContext.m:183) 15 CoreData 0x00000001a01c82b4 __52-[NSSQLDefaultConnectionManager handleStoreRequest:]_block_invoke + 60 (NSSQLConnectionManager.m:302) 16 CoreData 0x00000001a01c81ec __37-[NSSQLiteConnection performAndWait:]_block_invoke + 48 (NSSQLiteConnection.m:733) 17 libdispatch.dylib 0x000000019ff66dd4 _dispatch_client_callout + 20 (object.m:576) 18 libdispatch.dylib 0x000000019ff762c4 _dispatch_lane_barrier_sync_invoke_and_complete + 56 (queue.c:1100) 19 CoreData 0x00000001a01de8d0 -[NSSQLiteConnection performAndWait:] + 176 (NSSQLiteConnection.m:730) 20 CoreData 0x00000001a019d094 -[NSSQLDefaultConnectionManager handleStoreRequest:] + 248 (NSSQLConnectionManager.m:297) 21 CoreData 0x00000001a019cf64 -[NSSQLCoreDispatchManager routeStoreRequest:] + 228 (NSSQLCoreDispatchManager.m:60) 22 CoreData 0x00000001a019cd68 -[NSSQLCore dispatchRequest:withRetries:] + 172 (NSSQLCore.m:3975) 23 CoreData 0x00000001a01bc034 -[NSSQLCore executeRequest:withContext:error:] + 1208 (NSSQLCore.m:2951) 24 CoreData 0x00000001a01d06a0 __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke.541 + 4156 (NSPersistentStoreCoordinator.m:2994) 25 CoreData 0x00000001a01cf57c -[NSPersistentStoreCoordinator _routeHeavyweightBlock:] + 264 (NSPersistentStoreCoordinator.m:641) 26 CoreData 0x00000001a01abc48 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1048 (NSPersistentStoreCoordinator.m:2768) 27 CoreData 0x00000001a018bbdc -[NSManagedObjectContext executeRequest:error:] + 700 (NSManagedObjectContext.m:2044) 28 CoreData 0x00000001a0265be8 __116+[NSCKRecordMetadata batchUpdateMetadataMatchingEntityIdsAndPKs:withUpdates:inStore:withManagedObjectContext:error:]_block_invoke + 128 (NSCKRecordMetadata.m:744) 29 CoreFoundation 0x000000019806dfb4 __NSDICTIONARY_IS_CALLING_OUT_TO_A_BLOCK__ + 24 (NSDictionaryHelpers.m:10) 30 CoreFoundation 0x000000019806de2c -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 288 (NSDictionaryM.m:271) 31 CoreData 0x00000001a0265970 +[NSCKRecordMetadata batchUpdateMetadataMatchingEntityIdsAndPKs:
3
0
135
5d
The button click for real-time activity did not work.
We added a button in the real-time activity that responds within the app upon clicking. Now we're encountering an issue where, if you immediately click this button after swiping down to enter the notification center, it only opens the app without any scheme response. You have to wait for about 1 second after swiping down before the button can respond normally. Could you please tell us why this is happening?
0
0
74
1w
Inline Widget Displays Custom Image Abnormally
I want to display my own image in an inline widget. Using the SwiftUI Image syntax doesn't show the image, so following advice from online forums, I used the syntax Image(uiImage: UIImage(named: String)). This successfully displays the image, but if I change the image file name in the app, the image doesn't update properly. I tested displaying the image file name using Text in the inline widget, and it correctly shows the updated file name from my app. So, my AppStorage and AppGroups seem to be working correctly. I'd like to ask if there's a way to update my images properly and if there's an alternative method to display images without converting them to UIImage. Thanks.
0
0
93
1w
Inline Widget Displays Custom Image Abnormally
I want to display my own image in an inline widget. Using the SwiftUI Image syntax doesn't show the image, so following advice from online forums, I used the syntaxImage(uiImage: UIImage(named: String))This successfully displays the image, but if I change the image file name in the app, the image doesn't update properly. I tested displaying the image file name using Text in the inline widget, and it correctly shows the updated file name from my app. So, my AppStorage and AppGroups seem to be working correctly. I'd like to ask if there's a way to update my images properly and if there's an alternative method to display images without converting them to UIImage. Thanks.
0
0
75
1w
Screen time crashing
So I updated my phone to ios18 beta and ever since then my phone will always crash when I enter screen time but any other application nothing will happen, my phone has gotten so much slower and heats up faster. Lags so much! I dont know what else to do. I have 107gb and my max is 128gb so I don’t see that as the issue. Especially since I can’t enter into my screen time. I waited it out for almost two or one week. it hasn’t changed. restarted my phone and everything. please help asap!!!
3
3
223
1w
WidgetKit Simulator is missing in first Sequoia beta?
I updated to Sequoia beta 1 and seem to have lost the macOS widgetkit simulator. is this expected? My other mac running sonoma still has the simulator located at: /System/Library/CoreServices/WidgetKit Simulator.app trying to launch my widgets from Xcode 16 beta on my mac running sequoia results in this error: Couldn't find LSBundleProxy for provided bundle identifier: com.apple.widgetkit.simulator Domain: com.apple.dt.deviceservices.error Code: 3 User Info: { DVTErrorCreationDateKey = "2024-06-18 07:51:54 +0000"; IDERunOperationFailingWorker = IDELaunchServicesLauncher; } -- Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : { "device_identifier" = "00008112-0006250411FB401E"; "device_model" = "Mac14,2"; "device_osBuild" = "15.0 (24A5264n)"; "device_platform" = "com.apple.platform.macosx"; "device_thinningType" = "Mac14,2"; "dvt_coredevice_version" = "397.3.5.1"; "dvt_coresimulator_version" = 980; "dvt_mobiledevice_version" = "1757.0.0.101.1"; "launchSession_schemeCommand" = Run; "launchSession_state" = 1; "launchSession_targetArch" = arm64; "operation_duration_ms" = 1; "operation_errorCode" = 3; "operation_errorDomain" = "com.apple.dt.deviceservices.error"; "operation_errorWorker" = IDELaunchServicesLauncher; "operation_name" = IDERunOperationWorkerGroup; "param_debugger_attachToExtensions" = 1; "param_debugger_attachToXPC" = 1; "param_debugger_type" = 1; "param_destination_isProxy" = 0; "param_destination_platform" = "com.apple.platform.macosx"; "param_diag_113575882_enable" = 0; "param_diag_MainThreadChecker_stopOnIssue" = 0; "param_diag_MallocStackLogging_enableDuringAttach" = 0; "param_diag_MallocStackLogging_enableForXPC" = 1; "param_diag_allowLocationSimulation" = 1; "param_diag_checker_tpc_enable" = 1; "param_diag_gpu_frameCapture_enable" = 0; "param_diag_gpu_shaderValidation_enable" = 0; "param_diag_gpu_validation_enable" = 0; "param_diag_memoryGraphOnResourceException" = 0; "param_diag_queueDebugging_enable" = 1; "param_diag_runtimeProfile_generate" = 0; "param_diag_sanitizer_asan_enable" = 0; "param_diag_sanitizer_tsan_enable" = 0; "param_diag_sanitizer_tsan_stopOnIssue" = 0; "param_diag_sanitizer_ubsan_stopOnIssue" = 0; "param_diag_showNonLocalizedStrings" = 0; "param_diag_viewDebugging_enabled" = 1; "param_diag_viewDebugging_insertDylibOnLaunch" = 1; "param_install_style" = 2; "param_launcher_UID" = 2; "param_launcher_allowDeviceSensorReplayData" = 0; "param_launcher_kind" = 0; "param_launcher_style" = 0; "param_launcher_substyle" = 2; "param_runnable_appExtensionHostRunMode" = 1; "param_runnable_productType" = "com.apple.product-type.app-extension"; "param_structuredConsoleMode" = 1; "param_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "macosx15.0"; "sdk_osVersion" = "15.0"; "sdk_variant" = macos; } -- System Information macOS Version 15.0 (Build 24A5264n) Xcode 16.0 (23037.4) (Build 16A5171c) Timestamp: 2024-06-18T19:51:54+12:00
2
0
145
2w
No containerBackground content on Widget in iOS 18 tinted home screen style
The widget I have create for iOS 17 uses the containerBackground to display an image in the background. This works fine. But when I set the home screen to the iOS 18 tinted option the background disappears. I want the background to stay because it contains an image of that is meaningful to the user. I use the following code: @ViewBuilder var body: some View { if let memory = entry.memory, let uiImage = memory.image { Group { if entry.showCaption { memoryBody(with: memory) } else { Color.white.opacity(0.0000000001) } } .foregroundStyle(.white) .widgetBackground( Image(uiImage: uiImage) .resizable() .scaledToFill() ) } else if let memory = entry.memory { memoryBody(with: memory) .widgetBackground(Color.gray) } else { noMemoryBody() } } extension View { func widgetBackground(_ backgroundView: some View) -> some View { if #available(iOSApplicationExtension 17.0, *) { return containerBackground(for: .widget) { backgroundView } } else { return background(backgroundView) } } }
3
1
196
2w