Post

Replies

Boosts

Views

Activity

Reply to Screen Time hata
That's nice. How can we help? You need to show us your code, and tell us where the error is. From what you've put so far, my guess is you're sending the wrong thing to a method, but I can't be any clearer than that because you didn't post any code...
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Reply to App Stuck on Launch Screen When Debugging on iOS 18.5 Device with Xcode 16.3
Does it work when using the iOS Simulator on 18.4.1? How about a Simulator on 18.5? And one on 17? It might be your real device that has an issue, since you've said: It doesn't work on your device on iOS 18.5. It doesn't work on your device on iOS 18.4.1. It works on a different device on iOS 17. You haven't proven that it's not your device causing it, so try the other options, and see what happens.
May ’25
Reply to Unable to install iOS & watchOS app to iPhone, because of intents change
I moved onto using AppIntents instead. All the Siri Intents problems just went away. Here's what I have now: Main App target: Supported Intents is just WidgetEventIntent. Widgets target: No supported intents (and no section for them anyway) Watch App target: No supported intents (there is a section for them) Complications target: No supported intents (and no section for them anyway) Embedding: The Watch App and Widgets are embedded in the Main App. Complications is embedded in the Watch App. I also re-wrote the main app in Swift/SwiftUI and got rid of the old Objective-C version as it was so difficult to make things work with it. That's it.
May ’25
Reply to WidgetKit with Data from CoreData
Since you haven't responded, other than a comment, and you haven't accepted anything as an answer, here's a little more clarification in case you're still misunderstanding how to do this: Move the fetchRecords method into the DataManager class. Use a predicate to sort the data rather than sorting it after you've retrieved the records. It's faster. Change your ViewModel to something like this: class ViewModel: ObservableObject { let manager = DataManager() @Published var records: [Little] = [] init() { records = manager.fetchRecords() WidgetCenter.shared.reloadAllTimelines() } } DataManager can be shared between both your iOS target (where ViewModel resides) and your widget target, so change the target membership so it's shared. In your widget target, your getTimeline method would be something like this: func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) { let manager = DataManager() var items: [Item] = [] for record in manager.fetchRecords() { let item = Item(trashDate: record.trashDate ?? Date.now, imageSelection: Int(record.imageSelection)) items.append(item) } let entry = Timeline(entries: [SimpleEntry(date: Date(), items: items)], policy: .atEnd) completion(entry) } That should show you how to get data from Core Data into your widget. And, just to answer your other question, no you can't use your ViewModel as it isn't in the widget target, and you cannot call reloadTimelines() from the widget. If you're still having issues, then I'm sorry, but I've given you all the help I can. You haven't said whether you've attempted anything I've given you.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Reply to Window Bar missing (close, move and scale apps) - 2.5
These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding. Is this a question about an app you're developing on visionOS 2.5, or are you a consumer experiencing this general issue? If it's a general issue, please raise a bug at: https://feedbackassistant.apple.com/ and post the FB number here. Or, you can ask your question over at the Apple Support Forums. Thanks.
May ’25
Reply to WidgetKit with Data from CoreData
Well, I'm terribly sorry if I misunderstood your question, but it's quite difficult to make sense of what your question actually was given you posted: A DataManager class that just creates a connection to Core Data. A ViewModel class with a fetchRecords method that uses an instance of your DataManager class. Your TimelineProvider showing the same code from your fetchRecords method inside your getTimeline method. (As in, why the duplication?) If your question was the underlined question, "how should my widget get data from CoreData?" then I already answered it by explaing how I do it in my working widgets. You can use any method you want to get data into your widget, whether you pull it directly from the DataManager (via Core Data) or your ViewModel (which has already pulled it from Core Data). Have you tried both methods? Did one or both of them work? Which one has the simpler code? Go with that one. Remember, widgets shouldn't be considered actively running code. You tell the timeline provider what data the widget should use and what it should look like at a snapshot in time. The widget isn't sitting there reading your data from Core Data, so how you want to provide the data to it isn't 100% relevant. You only have to be performant in the getSnapshot method because that's used in transient situations like the preview gallery.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Reply to WidgetKit with Data from CoreData
Your DataManager class is my CoreData class, and in my case I'm creating one global instance of it, while you're doing this everywhere: let manager = DataManager(). With a global you can access it anywhere. The timeline() method just grabs my data with something like coredata.getMyData(), or in your case manager.fetchRecords(). You seem to be writing your fetchRecords() method to get your data inside the getTimeline() method, i.e.: let request = NSFetchRequest<Little>(entityName: "Little") do { records = try manager.context.fetch(request) ... That should be put into your DataManager() class. Also, use a predicate to sort your data in the call to CoreData, rather than sorting the records once you have them: records.sort { lhs, rhs in ... // <-- remove this
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Reply to Video takes me to private screen
These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding. Your question is more of a product support one, so I'd suggest you ask it over at the Apple Support Forums. If you feel it's a bug, you can raise it here: https://feedbackassistant.apple.com/ Thanks.
Topic: Safari & Web SubTopic: General
May ’25
Reply to WidgetKit with Data from CoreData
As widgets and the main iOS app are on the same device, they can use the same CoreData stack. I have a CoreData class with methods to access the stack in the Widget target. It's instantiated in the WigetExtensionBundle as a global let so it's available everywhere. Whenever I need to get data from CoreData I can just call something like coredata.shared.getMyData(). In my timeline method (not getTimeline as I'm using AppIntentTimelineProvider) I just call coredata.shared.getMyData().
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Reply to Screen Time hata
That's nice. How can we help? You need to show us your code, and tell us where the error is. From what you've put so far, my guess is you're sending the wrong thing to a method, but I can't be any clearer than that because you didn't post any code...
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to App Stuck on Launch Screen When Debugging on iOS 18.5 Device with Xcode 16.3
Does it work when using the iOS Simulator on 18.4.1? How about a Simulator on 18.5? And one on 17? It might be your real device that has an issue, since you've said: It doesn't work on your device on iOS 18.5. It doesn't work on your device on iOS 18.4.1. It works on a different device on iOS 17. You haven't proven that it's not your device causing it, so try the other options, and see what happens.
Replies
Boosts
Views
Activity
May ’25
Reply to Bank Account
Probably not. If it's asking for a bank account, you have to give it a bank account. Why would you want proceeds from your individual account to go to a corporate account?
Topic: Business & Education SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to Unable to install iOS & watchOS app to iPhone, because of intents change
I moved onto using AppIntents instead. All the Siri Intents problems just went away. Here's what I have now: Main App target: Supported Intents is just WidgetEventIntent. Widgets target: No supported intents (and no section for them anyway) Watch App target: No supported intents (there is a section for them) Complications target: No supported intents (and no section for them anyway) Embedding: The Watch App and Widgets are embedded in the Main App. Complications is embedded in the Watch App. I also re-wrote the main app in Swift/SwiftUI and got rid of the old Objective-C version as it was so difficult to make things work with it. That's it.
Replies
Boosts
Views
Activity
May ’25
Reply to WidgetKit with Data from CoreData
Since you haven't responded, other than a comment, and you haven't accepted anything as an answer, here's a little more clarification in case you're still misunderstanding how to do this: Move the fetchRecords method into the DataManager class. Use a predicate to sort the data rather than sorting it after you've retrieved the records. It's faster. Change your ViewModel to something like this: class ViewModel: ObservableObject { let manager = DataManager() @Published var records: [Little] = [] init() { records = manager.fetchRecords() WidgetCenter.shared.reloadAllTimelines() } } DataManager can be shared between both your iOS target (where ViewModel resides) and your widget target, so change the target membership so it's shared. In your widget target, your getTimeline method would be something like this: func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) { let manager = DataManager() var items: [Item] = [] for record in manager.fetchRecords() { let item = Item(trashDate: record.trashDate ?? Date.now, imageSelection: Int(record.imageSelection)) items.append(item) } let entry = Timeline(entries: [SimpleEntry(date: Date(), items: items)], policy: .atEnd) completion(entry) } That should show you how to get data from Core Data into your widget. And, just to answer your other question, no you can't use your ViewModel as it isn't in the widget target, and you cannot call reloadTimelines() from the widget. If you're still having issues, then I'm sorry, but I've given you all the help I can. You haven't said whether you've attempted anything I've given you.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to Window Bar missing (close, move and scale apps) - 2.5
These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding. Is this a question about an app you're developing on visionOS 2.5, or are you a consumer experiencing this general issue? If it's a general issue, please raise a bug at: https://feedbackassistant.apple.com/ and post the FB number here. Or, you can ask your question over at the Apple Support Forums. Thanks.
Replies
Boosts
Views
Activity
May ’25
Reply to Urgent: Reports of Duplicate Charges via AlipayHK on Apple Pay
No need for the duplicate post. Apple have already responded to you.
Replies
Boosts
Views
Activity
May ’25
Reply to Cant add user on app store connect (A user with this email address already exists on this team.)
What you shouldn't do is create a duplicate post with just a few minor changes. You have one hour to edit your original port. If you're outside of that one-hour window and your edits are necessary, just respond to your original post. No need to clog up the forums with duplicate posts.
Replies
Boosts
Views
Activity
May ’25
Reply to WidgetKit with Data from CoreData
Well, I'm terribly sorry if I misunderstood your question, but it's quite difficult to make sense of what your question actually was given you posted: A DataManager class that just creates a connection to Core Data. A ViewModel class with a fetchRecords method that uses an instance of your DataManager class. Your TimelineProvider showing the same code from your fetchRecords method inside your getTimeline method. (As in, why the duplication?) If your question was the underlined question, "how should my widget get data from CoreData?" then I already answered it by explaing how I do it in my working widgets. You can use any method you want to get data into your widget, whether you pull it directly from the DataManager (via Core Data) or your ViewModel (which has already pulled it from Core Data). Have you tried both methods? Did one or both of them work? Which one has the simpler code? Go with that one. Remember, widgets shouldn't be considered actively running code. You tell the timeline provider what data the widget should use and what it should look like at a snapshot in time. The widget isn't sitting there reading your data from Core Data, so how you want to provide the data to it isn't 100% relevant. You only have to be performant in the getSnapshot method because that's used in transient situations like the preview gallery.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to ScreenBlur is not happening always when app goes to app switcher.
Hard to tell if you don't post any code. Is this Obj-C or Swift? (I'm guessing Obj-C?) Are you sure applicationWillResignActive is being called? Does NSLog() show it being called every time? What if you add logging to all the other state change methods, are they called instead?
Topic: UI Frameworks SubTopic: UIKit
Replies
Boosts
Views
Activity
May ’25
Reply to isEligibleForIntroOffer(for:) aways return ture
There's no need to create a separate post for the same issue. Just reply to your original post. I'm marking this as a duplicate.
Topic: App & System Services SubTopic: StoreKit Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to WidgetKit with Data from CoreData
Your DataManager class is my CoreData class, and in my case I'm creating one global instance of it, while you're doing this everywhere: let manager = DataManager(). With a global you can access it anywhere. The timeline() method just grabs my data with something like coredata.getMyData(), or in your case manager.fetchRecords(). You seem to be writing your fetchRecords() method to get your data inside the getTimeline() method, i.e.: let request = NSFetchRequest<Little>(entityName: "Little") do { records = try manager.context.fetch(request) ... That should be put into your DataManager() class. Also, use a predicate to sort your data in the call to CoreData, rather than sorting the records once you have them: records.sort { lhs, rhs in ... // <-- remove this
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to guard let result = try? await evaluateJavaScript Crash
Is it failing on let titleResult or let title? Try splitting the guard statement into two and see which one it fails on. It's a good idea to separate those two statements because the second one is relying on the result of the first one, and they are likely being evaluated at the same time.
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to Video takes me to private screen
These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding. Your question is more of a product support one, so I'd suggest you ask it over at the Apple Support Forums. If you feel it's a bug, you can raise it here: https://feedbackassistant.apple.com/ Thanks.
Topic: Safari & Web SubTopic: General
Replies
Boosts
Views
Activity
May ’25
Reply to WidgetKit with Data from CoreData
As widgets and the main iOS app are on the same device, they can use the same CoreData stack. I have a CoreData class with methods to access the stack in the Widget target. It's instantiated in the WigetExtensionBundle as a global let so it's available everywhere. Whenever I need to get data from CoreData I can just call something like coredata.shared.getMyData(). In my timeline method (not getTimeline as I'm using AppIntentTimelineProvider) I just call coredata.shared.getMyData().
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25