Post

Replies

Boosts

Views

Activity

Results with spotlight in Core Data is not all.
I'm using Core Data to save data. Then I wanna add spotlight support. self.spotlightDelegate = StorageSpotlightDelegate(forStoreWith: description, coordinator: container.persistentStoreCoordinator) let isSpotlightDisable = UserDefaults.standard.bool(forKey: "isSpotlightDisable") if !isSpotlightDisable { self.toggleSpotlightIndexing(enable: true) } public func toggleSpotlightIndexing(enable: Bool) { guard let spotlightDelegate = spotlightDelegate else { return } if enable { spotlightDelegate.startSpotlightIndexing() } else { spotlightDelegate.stopSpotlightIndexing() spotlightDelegate.deleteSpotlightIndex { error in if let error = error { print(error) } } } UserDefaults.standard.set(!enable, forKey: "isSpotlightDisable") } It works fine on an iOS15 device, but not work on iOS 17&18. On iOS 18 devices, I can search the data when the first time to added to Core Data. But if I stop spotlight indexing and restart again, the data is never be searched. How can I to solve this? And I noticed that the problem is also exists in another dictionary app.
0
0
114
2w
UIButton action not called in UIHostingController
I have added a button in UIController: let button = UIButton(type: .custom) button.setTitle("test", for: .normal) button.addTarget(self, action: #selector(addToSiri), for: .touchUpInside) self.view.addSubview(button) Then using it in SwiftUI HStack { Controller() }.frame(maxWidth:.infinity, idealHeight: 60) And then using swiftUI in UIHostingController: let vc = UIHostingController(rootView: SwiftUIView()) But when I tap the button, the addToSiri is never called. I don't know why.
3
0
367
May ’24
InteractivePopGestureRecognizer is disabled after push to a UIHostingController with SwiftUI
I have pushed an UIHostingController which contains SwiftUI and set the navigationBar hidden: class CoverVC : UIHostingController<AnyView>{ public init(shouldShowNavigationBar: Bool, rootView: ICloudSyncView) { super.init(rootView: AnyView(rootView.navigationBarHidden(!shouldShowNavigationBar))) self.navigationController?.interactivePopGestureRecognizer?.delegate = self } @objc required dynamic init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } } extension CoverVC: UIGestureRecognizerDelegate { func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool { return true } } But the InteractivePopGestureRecognizer is disabled. How can I to solve this?
0
0
336
May ’24
How to keep the core data updated in app and extensions.
I'm using core data in app, widget extension and intent, but I found the data is not updated between targets. such as I added a new record in app, the widget is not updated unless remove the widget and re-add it. I added a new record in intent, the data in app is not updated unless I run the app again. I have set container.viewContext.automaticallyMergesChangesFromParent = true but it doesn't work. So how can I make the data is updated no matter it is modified any targets.
0
0
472
May ’24
The file in app group container is still exsits when I install again after deleting the app?
I have copied an sqlite file from document to app group container. I found that if I delete the app and reinstall, the file is automatically created. How is that happed? The app group container is not just a folder and can be synchronized by iCloud? I cannot find any informations about the feature. If there is, please show me the link, thanks
0
0
472
Feb ’24
There was a problem with the app when running app from shortcuts
I wanna add an intents app extension on iOS 15, I'm following the link https://toolboxpro.app/blog/adding-shortcuts-to-an-app-1. It works fine when running the extension target on device, but here comes the error "Could not run Make Uppercase,There was a problem with the app" when I running the main target. There is no exception or breakpoint in Xcode so I don't know what's the problem. Any help will be appreciate, thanks.
0
0
528
Jan ’24