Post

Replies

Boosts

Views

Activity

Does NSManagedObjectContext reduce operations for UndoManager?
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?
0
0
562
Nov ’21
Do multiple transactions created or modified within a certain period be emitted as a single Transaction.updates event?
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
1
0
1.3k
Mar ’22
Can an App detect a subscription's cancellation in itself?
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?
3
0
1.6k
Mar ’22
BUG: Broken NavigationStack when .bottomBar and back-half-swipe
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
1
5
800
Oct ’23
How to handle a `AppIntent.perform()` error in Widget?
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?
1
2
595
Feb ’24
Any workaround for expanding a large category in FamilyActivityPicker?
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}>
5
1
559
Sep ’24