Post

Replies

Boosts

Views

Activity

Reply to Cannot import EventKitUI. Error Could not build Objective-C module
OK. I found out that EventKitUI can not be used with widget. Took me a while to learn about this. More detail. In one of my file in my main app, I use EventKitUI. And I also check the widget target in the Target Membership of this file. When I remove the checkmark everything works fine. So, in my situation I have to create another swift file in the main app and move the EventKitUI part out of my main file and put it in the newly created file. Everything is working now. Thank you.
Jul ’21
Reply to getTimeline called twice on load
Not sure if I answer your question but I found out that getTimeline gets called for each widget size. If I have only small widget (one or two or more) getTimeline called once. If I have small widget and medium widget, getTimeline called twice. If I have small, medium, large widgets, getTimeline called three times. Took me couple of days to know this. It might be helpful to you.
Jul ’21
Reply to Running Background Tasks
If I may, I have similar situations that would like to ask. I want to be able to execute some codes from background task whenever there are changes in Eventstore (calendar/reminder). I need to update data in my app (and my widget) when this change happen. How can I do this? I can't figure out how to listen to notification from Eventstore in the background. Thank you very much, Boon
Aug ’21
Reply to SwiftUI Mac Catalyst how to programmatically close / minimize window
Ok. I figured it out. This might be helpful to others. Step 1 Add this to AppDelegate class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {             let configuration = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role)             if connectingSceneSession.role == .windowApplication {                 configuration.delegateClass = SceneDelegate.self             }             return configuration         } } Step 2 Create SceneDelegate class SceneDelegate: NSObject, ObservableObject, UIWindowSceneDelegate {     var window: UIWindow?     func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {         guard let windowScene = scene as? UIWindowScene else { return }         self.window = windowScene.keyWindow     } } Step 3. Then call it like this.... @EnvironmentObject var sceneDelegate: SceneDelegate . . . .                     if let myWindow = sceneDelegate.window {                         print(myWindow.description)                         guard let scene = myWindow.windowScene else { return }                         let options = UIWindowSceneDestructionRequestOptions()                         options.windowDismissalAnimation = .commit                         UIApplication.shared.requestSceneSessionDestruction(scene.session, options: options, errorHandler: { error in                             // TODO: - Handle error                             print("Error")                         })                     }
Aug ’22
Reply to SwiftUI sheet dismiss warning
Forgot to add this.... I ran the exact same code on macOS and no warning at all. On Mac there is no swipe down. So the only option is clicking dismiss button on a sheet. And after clicking the dismiss, no warning. Seems to be there is a bug in iOS.
Sep ’22
Reply to iOS16 Widget Lock Screen show sensitive information even if .privacySensitive() is set
Hello, Sorry for such a late reply... Attached image is Apple's calendar widget when iPhone is still in Lock state. (Swipe right) It shows everything. Every widgets (calendar, reminder, email) on my iphone show information even when the phone is still locked. This includes my app as well. So I guess the problem is not with my app. However, since you said your iphone works correctly maybe it is a problem with my phone then. Thank you.
Oct ’22
Reply to iOS16 Widget Lock Screen show sensitive information even if .privacySensitive() is set
Well... I figured it out. In Settings>Face ID & Passcode. There is a toggle for "Lock Screen Widgets". This has to be turned off in order for widgets on lock screen and widgets in Today View to be redacted in Lock state. And once this toggle is turned off, .privacySensitive logic is working correctly. I have no idea when this was turned off. I don't think I turned it off but maybe I did. Curious what is the default option for this toggle...
Oct ’22
Reply to MediaLibrary inaccessible on iOS 16.1 for Widget Extensions
This might not be related to your post but I would like reply here for reference as well. I think iOS16.1 also blocks access to calendar database as well. My widget app displays info from calendar and it stops working correctly since iOS16.1. It happens when the widget try to refresh the timeline (thus need to access calendar database). If I refresh the widget from within my app, the widget can access calendar database correctly. I have also found a post on Reddit regarding this issue - https://www.reddit.com/r/iOSBeta/comments/xgship/ios_161_b1_3rd_party_calendar_widgets_not_working/ Hope Apple will fix this soon.
Nov ’22