Hello.
My project includes a widget target that provides interactive widget functionalities. The document "Adding Interactivity to Widgets and Live Activities" says the following:
Additionally, note that the perform() function is marked as throws. Be sure to handle errors instead of rethrowing them, and update your app, widget, and Live Activity as needed. For example, update a widget’s interface to indicate that it displays outdated information if it cannot load new data.
https://developer.apple.com/documentation/widgetkit/adding-interactivity-to-widgets-and-live-activities#Implement-the-perform-function, column 3
However, I couldn't find a way how to handle an error in an interactive widget. The Button(intent:) and Toggle(intent:) initializers don't have mechanisms for error handling.
Does anyone know a solution for handling errors in interactive widgets?
Post
Replies
Boosts
Views
Activity
I’m developing a self-management app using Family Controls, but I’ve encountered a FamilyActivityPciker's crash due to an XPC(or UIRemoteView) issue when there are too many tokens(maybe 200+ items) in a category. This makes bad UX, so I’m looking for a workaround.
(I guess that the crash reason is cross process memory limitations, such as App Extension 50MB memory limitation.)
A lot of web domains contribute to increase the number of tokens, However, even after clearing Safari’s browsing history, the tokens displayed in the FamilyActivityPicker remains unchanged.
Is there any workaround that a 3rd party developer can implement to address this issue? prevent FamilyActivityPicker crashes or reduce the number of web domain tokens?
For example, if there’s a way to reset the web domain tokens shown in FamilyActivityPicker from the Settings app, I could offer a help to users.
Does anybody have ideas?
Expanding SNS Category (29 items)
It succeeded.
Expanding Productivity & Finance (214 items)
It failed. The screen froze, then appears blank. When the number of items is around 100, the crash rate is 50%, but when the items are over 200, the crash rate is 100%.
Search Bar Problem
The search bar also has same problem. If the number of search results are small, it works good without any blank, but if there are a lot of search results (200+), the XCP crashes and the screen appears blank.
Code to Reproduce
import SwiftUI
import FamilyControls
struct ContentView: View {
@State private var selection = FamilyActivitySelection()
@State private var isPickerPresented: Bool = false
var body: some View {
VStack {
Button("Open Picker") {
isPickerPresented = true
}
}
.familyActivityPicker(isPresented: $isPickerPresented, selection: $selection)
}
}
Steps to Reproduce
Prepare a category that has 200+ items
Try to open the category in the picker
The screen will freeze, then appears blank.
Errors in Console
[u EDD60B83-5D2A-5446-B2C7-57D47C937916:m (null)] [com.apple.FamilyControls.ActivityPickerExtension(1204)] Connection to plugin interrupted while in use.
AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:2164 (
0 AXRuntime 0x00000001d46c5f08 _AXGetPortFromCache + 796
1 AXRuntime 0x00000001d46ca23c AXUIElementPerformFencedActionWithValue + 700
2 UIKit 0x0000000256b75cec C01ACC79-A5BA-3017-91BD-A03759576BBF + 1527020
3 libdispatch.dylib 0x000000010546ca30 _dispatch_call_block_and_release + 32
4 libdispatch.dylib 0x000000010546e71c _dispatch_client_callout + 20
5 libdispatch.dylib 0x00000001054765e8 _dispatch_lane_serial_drain + 828
6 libdispatch.dylib 0x0000000105477360 _dispatch_lane_invoke + 408
7 libdispatch.dylib 0x00000001054845f0 _dispatch_root_queue_drain_deferred_wlh + 328
8 libdispatch.dylib 0x0000000105483c00 _dispatch_workloop_worker_thread + 580
9 libsystem_pthread.dylib 0x0000000224f77c7c _pthread_wqthread + 288
10 libsystem_pthread.dylib 0x0000000224f74488 start_wqthread + 8
)
Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}>
StoreKit2 provide great API AppStore.showManageSubscription(in:) to downgrade, upgrade or cancel the user's subscription, however, can the App detect the cancellation in App? (without server to server notification)
I understand the upgrade and downgrade can be detected in Transaction.updates, but I'm not sure about the cancellation.
I want to update my label's text from Next billing date: \(date) to Expires \(date) if the user cancels the subscription in showManageSubscription(in:) sheet.
Can I implement that?
With NavigationStack, attaching a ToolbarItem(placement: .bottomBar) and doing a back-half-swipe gesture causes a navigation title bug.
Gif
Reproduce Code
import SwiftUI
enum NavigationDestination: Hashable {
case secondView
}
struct ContentView: View {
var body: some View {
NavigationStack {
FirstView()
.navigationDestination(for: NavigationDestination.self) { value in
switch value {
case .secondView:
SecondView()
}
}
}
}
}
struct FirstView: View {
var body: some View {
NavigationLink(value: NavigationDestination.secondView) {
Text("Go Next")
}
.navigationTitle("First View")
.toolbar {
/*
Navigation bar will be broken by .bottom bar when back-half-swipe.
*/
// Bug reproduce .bottomBar toolbar items
//
ToolbarItemGroup(placement: .bottomBar) {
Text("Done")
}
// No ploblem when .topBarTrailing
// ToolbarItemGroup(placement: .topBarTrailing) {
// Text("Done")
// }
}
}
}
struct SecondView: View {
var body: some View {
ZStack {
Color.blue.frame(maxWidth: .greatestFiniteMagnitude, maxHeight: .greatestFiniteMagnitude)
Text("This is second view.")
.navigationTitle("Second View")
.navigationBarTitleDisplayMode(.inline)
}
}
}
Feedback Report Number
FB13284524
In CoreData with CloudKit mirroring, only lightweight migration is allowed to database migration. Heavyweight (custom) migration are not recommended.
Are the rules also applied to SwiftData with CloudKit mirroring? (I assume it is true, because cloudkit backend properties are not changed even if SwfitData released)
For implementing a Store functionalities and tests by using StoreKit2, I have a task listener and two testcases.
The first one is waiting the update notification before processing the next SKTestSession operation.The second one is not waiting the update.
I looked update events theree times on first one, and twice on second one.
My question is, "Do multiple transactions created or modified within a certain period be emitted as a single Transaction.updates event?"
Task listener
Testcase1
Testcase2
The status property is described as get async throws, but the details of the error is not described yet.
Is the error Product.PurchaseError?.
I have a NSManagedObjectContext instance that have non-nil value in undoManager property, and I have a method to increment integer value of all managed objects like this:
func incrementAllOrderProperty() {
let fetchRequest: NSFetchRequest<Entity> = Entity.fetchRequest()
fetchRequest.sortDescriptor = mySortDescriptors
let entities = try! managedObjectContext.fetch()
for entity in entities {
entity.order += 1
}
}
My question is that the context makes sure reducing each process in the loop makes into one undo operation? or dividing processes to multiple undo operations? and is there a way to set an explicit undo context to the managedObjectContext?
Recently, I've started to learn deep TextKit APIs and concepts, such as typeface, typesetter, Text Layout and so on.
I found APIs named lineFragmentRect and lineFragmentUsedRect, however I can't understand these conceptual difference. (These values are bit of different.)
Cloud you tell me them if you know something about it?
Hi.
I've already use press(forDuration:thenDragTo:withVelocity:thenHoldForDuration - https://developer.apple.com/documentation/xctest/xcuicoordinate/3551692-press method to simulate single drag in my XCUITest target, and I want to test multiple drag selection interaction with it. Can I simulate two or more simultaneous user interactions with any public APIs?
Can I fire NSPersistentCloudKitContainer update manually? I want to schedule data sending event for server after unrestricting CloudKit restriction by CloudKit Web Service API.
Hello.
UITableView provides a drop indicator in mac Catalyst by default, but I want to customize its indentation level and width, or removing it then implementing them by myself.
Can I customize or remove the UITableView's drop indicator in Catalyst?
I am trying to implement both ContextMenu and Drag&Drop in UITableView like Apple Note or Photo app, but the contextual menu prevent dragging in iOS.
How to coexist them? I don't have any idea about that so would you give me some ideas?(I had tried to find related articles, but never found...)
Does anyone know a way to implement UITextView dynamic height in UICollectionLayoutListConfiguration?(using custom cell)
I've tried it before, but the cell height wasn't changed while editing the UITextView.
Environment
Xcode12 beta4
iOS14 beta4
big Sur beta4
Cannot find NSDiffableDataSourceSectionSnapshot when selecting the target for macOS catalyst, but the document describes it can be used in macOS catalyst 14+.
Can I use it in public Xcode12? (that will be released in tomorrow...)
Environment
Xcode12 GM(12A7209)