Post not yet marked as solved
Is it possible to read the battery levels of my other devices from swift uizer like widgets? can you help?
Post not yet marked as solved
device: iPhone 13 Pro max;
system version: 16.0 16.0.2 ;
no custom widget in Widget Center;
In my app, there's a widget that should change to one color when clicked and then to another color after 10 seconds.
When I click the widget button (linked to the App Intent), the widget should refresh. When I debug, this happens as expected.
However, if I call WidgetCenter.shared.reloadAllTimelines() in the perform() method of AppIntent, the widget timeline doesn't refresh right away. This issue only happens on real devices and isn't always consistent. In the simulator, the widget refreshes as expected.
Post not yet marked as solved
Hi,
I just downloaded Xcode 15.3 beta 3 and went to create a new project, however I cannot find the widget extension. Do I have to enable this extension or download it?
Post not yet marked as solved
I run the WidgetKit project on iOS 17 in build configuration: release, while debug executable is working, it works fine, I click on the button in the widget everything works, but without it it breaks
Post not yet marked as solved
WidgetKit library was presented appeared on WWDC20, and since then there has been no way to bring users to the Widget Gallery, and this becomes a stumbling block for many developers, since we are not able to send our users to developed widgets
I suggest Apple add a custom URL scheme similar to that for system applications:
facetime://user@example.com
sms:1-111-111-0037
And this URL Scheme is up to Apple, but there is a few thoughts about it:
How the URL might look like:
widgetgallery:
widgetgallery:type=<...>&family=<...>
URL Scheme parameters:
type - widget's kind string identifier, defined in app
family - family of widget
This will help make widgets more common among users, as well as increase conversion in their additions. For this reason, the development of widgets will become an appropriate feature for companies
Post not yet marked as solved
Hello all,
Is there any best practice how it's possible to add native visionOS support for existing app, that already includes WidgetKit extension, where both targets should share some files?
"Your target is built for visionOS but contains embedded content built for the iOS platform (WidgetsExtension.appex), which is not allowed"
Thanks a lot!
Post not yet marked as solved
I added a spotify widget on the first page of my home screen. That widget is working fine and totally normal. On the second page of my home screen, there is another widget floating with the little minus sign like when you add or delete an app/widget on your screen. My apps sit on top of it, I can't move it, I can't delete it. Anyone dealt with this before?
Post not yet marked as solved
Hi,
In my apps, the recent iOS 16.0 beta 7 (20A5356a) broke the .timer DateStyle property of the Text view, in a SwiftUI widget.
In previous OS and beta, Text(Date(), style: .timer) was correctly displaying an increasing counter.
In iOS 6.0 beta 7, Text(Date(), style: .timer) does not update anymore, (and is offset to the left).
The other DateStyle (like .offset, .relative, ...) seems to update correctly.
Anyone noticed that (very specific) problem ?
Post not yet marked as solved
⌚️Hello,
I've noticed in watchOS 10 that when a complication is in the Smart Stack, the value of WCSession.isComplicationEnabled is false. I'm not sure if this is intentional or a bug. It seems trivial at first glance, but it actually affects the communication mechanism mentioned in Implementing Two-Way Communication Using Watch Connectivity.
In the following two scenarios, if the user has only added the app's complication to the Smart Stack, then the watch app will not be able to communicate properly with the iOS app.
Scenario 1 - WCSession.transferCurrentComplicationUserInfo()
// update complications from the iOS app
if WCSession.default.isComplicationEnabled {
let userInfoTransfer = WCSession.default.transferCurrentComplicationUserInfo(userInfo)
// ...
}
As described in Implementing Two-Way Communication Using Watch Connectivity, when the iOS app proactively updates the data of the watch app, since WCSession.isComplicationEnabled is false, WCSession will refuse to transfer any data. This causes the standalone complication in Smart Stack to not be updated.
Scenario 2 - WKApplicationRefreshBackgroundTask
When the watch app uses WKApplication.scheduleBackgroundRefresh() to periodically update data, as long as the user has added the app's complication to the watch face, the corresponding WKApplicationRefreshBackgroundTask can be executed periodically in the background to fetch data.
However, if the user has only added complication to the Smart Stack, then the watch app will be completely purged, and the background task will not be executed at all. Although WCSession.isComplicationEnabled is not directly used in this scenario, its behavior appears to be the same, that is, the complication in the Smart Stack is not considered a complication by the system.
Should I submit a bug report?
Post not yet marked as solved
Environment:
iOS Version: 17.2
iOS Simulator Version: 17.2
Xcode Version: 15.2
Device: iPhone 15 Pro Max
App Target Version: iOS 17.2
Preconditions:
App with Live Activity feature is installed.
Device/Simulator is running iOS 17.2.
Steps to Reproduce:
Start the app and initiate a Live Activity with text styled as .timer.
Lock the device screen or switch to the lock screen view in the iOS Simulator.
Observe the Live Activity on the lock screen, noting the text style.
Unlock the device. This time noting the .timer changed its style.
The text style of the Live Activity remains consistent both on the lock screen and after unlocking the device, maintaining its .timer style throughout its lifecycle.
Frequency:
Occurs every time the steps are reproduced.
Post not yet marked as solved
I am facing an issue with the .after policy in SwiftUI Timeline. The update is not occurring at the exact time I have specified; there are delays ranging from 5 minutes to 3 minutes, etc. How can I resolve this issue? What can I do to ensure that the update happens precisely at the specified time without any delay?
Code Example:
struct SimpleEntry: TimelineEntry {
let date: Date
}
func getTimeline(in context: Context, completion: @escaping (Timeline<SimpleEntry>) -> Void) {
// For example, a future date and time: 2024-02-01 12:00:00
let refreshDateComponents = DateComponents(year: 2024, month: 2, day: 1, hour: 12, minute: 0, second: 0)
// Create a Date object using the specified date and time
if let refreshDate = Calendar.current.date(from: refreshDateComponents) {
// Create a SimpleEntry using the generated Date object
let entry = SimpleEntry(date: refreshDate)
// Create a Timeline and perform the completion with it
let timeline = Timeline(entries: [entry], policy: .after(refreshDate))
completion(timeline)
}
// Return an empty Timeline in case of an error
else {
let emptyTimeline = Timeline(entries: [], policy: .never)
completion(emptyTimeline)
}
}
Post not yet marked as solved
I see this warning a lot in console.log when my widgets update, is it just noise or is there something I could be doing wrong in my widgets. I don't do anything explicitly with the runloop in my code, it's just regular SwiftUI to render a widget.
I'm looking to migrate my users ClockKit complications to WidgetKit in my next app update. I can only do this for WatchOS 10 users because the APIs are too limited for WatchOS 9 (eg. Widget corner round text not available). But I do need to do this for WatchOS 10 users in order to get in the Smart Stack.
When I tried to mark my getWidgetConfiguration method in my ComplicationController.swift with:
@available(watchOS 10.0, *)
it complains and says: Protocol 'CLKComplicationWidgetMigrator' requires 'getWidgetConfiguration(from:completionHandler:)' to be available in watchOS 9.0 and newer
I then tried modifying my WidgetKit extension to only support WatchOS 10. This seems to work for a while but at some point WatchOS 9 devices still try the migration and crash with symbolNotFound DYLD issues for the WidgetKit extension which shouldn't even be embedded in the WatchOS 9 builds! (all visible in iPhone Analytics data crashes)
So I'm not sure what else to try. I've researched a lot in docs etc... but can find no official way to achieve this.
Post not yet marked as solved
我想使用小组件展示地图位置等信息。但是小组件貌似无法展示出地图。我的问题是,小组件是否支持地图组件的展示呢?
I have a Xcode project with a widget extension, Xcode, simulator and terminal are running with Rosetta (I can't change this).
When I build and run the main project, the widget does not get loaded on the widgets list, when running the widget scheme on Xcode the app crashes when loading the application on simulator. Same happens on device.
Macs with Intel silicon run it okay. Xcode without rosetta is also okay.
Xcode log window shows the following message:
SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 "Failed to show Widget 'Gabriel.Widget-Rosetta.Widget' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (Gabriel.Widget-Rosetta.Widget)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (Gabriel.Widget-Rosetta.Widget)}." UserInfo={NSLocalizedDescription=Failed to show Widget 'Gabriel.Widget-Rosetta.Widget' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (Gabriel.Widget-Rosetta.Widget)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (Gabriel.Widget-Rosetta.Widget)}., NSUnderlyingError=0x600001106010 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (Gabriel.Widget-Rosetta.Widget)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (Gabriel.Widget-Rosetta.Widget)}}}
Domain: DTXMessage
Code: 1
User Info: {
DVTErrorCreationDateKey = "2022-07-06 14:45:31 +0000";
}
--
System Information
macOS Version 12.2.1 (Build 21D62)
Xcode 13.2.1 (19586) (Build 13C100)
Timestamp: 2022-07-06T15:45:31+01:00
Console shows the following message:
libc++abi: terminating with uncaught exception of type NSException
dyld4 config: DYLD_FRAMEWORK_PATH=/Users/gabriel.soria/DD/Widget-Rosetta-bhlamdqmnxdfvtapitjtbxxspnfc/Build/Products/Debug-iphonesimulator DYLD_LIBRARY_PATH=/Users/gabriel.soria/DD/Widget-Rosetta-bhlamdqmnxdfvtapitjtbxxspnfc/Build/Products/Debug-iphonesimulator DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_NSXPCDistantObject ___nsx_pingHost:]: unrecognized selector sent to instance 0x600003948aa0'
_LSContextInitReturningError() failed with error Error Domain=NSOSStatusErrorDomain Code=-10817 "(null)" UserInfo={_LSFunction=_LSSchemaConfigureForStore, ExpectedSimulatorHash={length = 32, bytes = 0xf6701f12 bb1a56bb bba5f39f 3f7801a6 ... f9fe6ee0 ef307d24 }, _LSLine=405, WrongSimulatorHash={length = 32, bytes = 0x9da4b2b1 56f7ac19 1a99bc21 b7ec95c2 ... c4004d14 03ef83dc }}
terminating with uncaught exception of type NSException
CoreSimulator 783.5 - Device: iPhone SE (2nd generation) (E360DB1E-33FF-45A4-926C-A6093DFB3699) - Runtime: iOS 15.2 (19C51) - DeviceType: iPhone SE (2nd generation)
Post not yet marked as solved
Whenever I try to put my choice of time zones on the MacBook clock widget, it won't show on the main widget. It will show the stock clock options. Such as Cupertino, Tokyo, Sydney, and Paris, Even though I change them inside the app the widget won't display the changes.
Post not yet marked as solved
Hello,
I created a lock screen widget for my app last year, as a widget app extension. It has worked fine, but I am working on a new release and it has stopped updating:
It is not called anymore when I call WidgetCenter.shared.reloadTimelines(ofKind: "MyWidget"), and the preview screen is now blank when I add it on the lockscreen.
I haven't touched anything related to the widget from what I know. The only things I can think of is that Xcode has updated my project files automagically, and I have updated cocoapods.
I looked at the device logs, and found this:
[...MyWidget] Failed to launch extension with error: Error Domain=com.apple.extensionKit.errorDomain Code=2 UserInfo={NSUnderlyingError=0x84b4d4410 {Error Domain=RBSRequestErrorDomain Code=5 UserInfo={NSLocalizedFailureReason=, NSUnderlyingError=0x84b45ea30 {Error Domain=NSPOSIXErrorDomain Code=111 UserInfo={NSLocalizedDescription=}}}}}.
I have no idea what this is, hoping someone can come up with suggestions on where to look. I have looked at my git history but I can't find anything changed.
Post not yet marked as solved
I'm in process of reimplementing my app in SwiftUI and WidgetKit. So far so good, I really like that I can finally use SwiftUI views for widgets.
However, I'm having issues with AccessoryInline widget on Utility watch face. My old UtilitarianLarge complication displays in full color, but AccessoryInline widget displays only in gray - it's not even widgetAccentable on Utility watch face.
I receive widgetRenderingMode from the Environment, and it shows fullColor. However, no matter how I try to apply color to the image or text, both stay gray.
This widget family is not documented well (as many of things in WatchOS), and Google/ChatGPT/Bing produced zero usable results.
It looks like it's a bug in WIdgetKit. If it's supposed to be displayed in Accented mode only, it should report as such in widgetRenderingMode (and support WidgetAccentable). Otherwise it should display in full color, just like the old complication.
Post not yet marked as solved
Hi,
In our tests, especially when we tested the new widgets with interactions (introduced in iOS 17), we found that sometimes they can hang when fetching data from CoreData using background context.
I realise that there is no reason to use background context in widgets, but in our case we were reusing logic and so there were multiple background contexts. I'm trying to find information about using background context in widgets, but I can't find it.
Now we avoid using background context in widgets, but it would be interesting to know if the use of CoreData background context in widgets is not allowed or could it be a kind of bug?
Perhaps this information would be useful to anyone trying to find the cause of widget hangs.