Posts

Post not yet marked as solved
5 Replies
Have you found a solution to this problem? My schema has 2 versions, and I want to migrate with a custom stage migration. My app crashes at launch with the following error: Thread 1: "Duplicate version checksums across stages detected.". I filed feedback #FB13647876 and request a technical support.
Post not yet marked as solved
3 Replies
I realized the issue is actually caused by the use of Section. If I keep my same code I shared but remove the sections in the sidebar List, I don’t have the issue anymore. If I keep at least one section, it crashes. List(selection: $selectionString) { NavigationLink(value: SelectionString.all) { Text("All") } ForEach(strings.sorted(), id: \.self) { string in NavigationLink(value: SelectionString.item(string)) { Text(string) } } }
Post not yet marked as solved
3 Replies
Here is the code to reproduce the issue: import SwiftUI @main struct FB_SwiftUI_NavigationSplitView_Delete_SelectApp: App { var body: some Scene { WindowGroup { ContentView() } } } enum SelectionString: Hashable { case all case item(String) } struct ContentView: View { @State private var selectionString: SelectionString? @State private var strings: [String] = [] var body: some View { NavigationSplitView { List(selection: $selectionString) { Section { NavigationLink(value: SelectionString.all) { Text("All") } } Section { ForEach(strings.sorted(), id: \.self) { string in NavigationLink(value: SelectionString.item(string)) { Text(string) } } } } .toolbar { ToolbarItem { Button("Add") { strings.append(UUID().uuidString) } } } } detail: { if let selectionString { switch selectionString { case .all: Text("All") case .item(let string): Button(role: .destructive) { if let index = strings.firstIndex(of: string) { strings.remove(at: index) self.selectionString = nil } } label: { Text("Delete") } } } else { Text("Select an item") } } } }
Post not yet marked as solved
3 Replies
I tested with other date components to see if the dates provided by these methods are correct when searching backward. I tested using a .nextTime and .strict matchingPolicy. DateComponents(month: 1) Correct years, wrong days. I mainly get dates around January the 5th. But the years seem to be correct. In this case, only the America/Los_Angeles date seems to be correct. Even GMT is wrong. 2023-01-05 00:00:00 +0000 for Europe/London 2023-01-04 23:00:00 +0000 for Europe/Paris 2023-01-04 22:00:00 +0000 for Europe/Vilnius 2023-01-01 08:00:00 +0000 for America/Los_Angeles 2023-01-05 00:00:00 +0000 for GMT DateComponents(month: 2) Correct years, correct days DateComponents(month: 3) Correct years, wrong days DateComponents(month: 4) Correct years, correct days DateComponents(month: 5) Correct years, wrong days. I mainly get dates around May the 3rd. 2023-05-02 23:00:00 +0000 for Europe/London 2023-05-02 22:00:00 +0000 for Europe/Paris 2023-05-02 21:00:00 +0000 for Europe/Vilnius 2023-05-03 07:00:00 +0000 for America/Los_Angeles 2023-05-03 00:00:00 +0000 for GMT DateComponents(month: 6) Correct years, correct days DateComponents(month: 7) Correct years, wrong days DateComponents(month: 8) Correct years, wrong days DateComponents(month: 9) Wrong years, correct days DateComponents(month: 10) Correct years, wrong days DateComponents(month: 11) Correct years, correct days DateComponents(month: 12) Wrong years, wrong days Expected Result: first day of December of this year (when after is December the 5th for example). Actual Result: It provides the last day of December for the previous year. If I additionally specify a day in the date components like DateComponents(month: 1, day: 1), I get the correct results for all time zones, except for September (still wrong years). So two issues: If only a month is specified, the backward results are often wrong: either the year (like in September or December), or the days (if I only provide the month, I expect the function to give me the start of the month that matches this month date component). If the specified month is September, the year and day in provided date are wrong for a lot of time zones.
Post not yet marked as solved
3 Replies
I just tested with other time zones and the results are different... For some time zones, the result is correct, for others, not. I used the following code to print the result for all time zones. Optional(1970-08-31 23:00:00 +0000) for Europe/London Optional(1995-08-31 23:00:00 +0000) for Europe/Paris Optional(2002-08-31 22:00:00 +0000) for Europe/Vilnius Optional(2023-09-01 07:00:00 +0000) for America/Los_Angeles for zone in TimeZone.knownTimeZoneIdentifiers { var calendar: Calendar = Calendar(identifier: .gregorian) calendar.timeZone = TimeZone(identifier: zone) ?? .autoupdatingCurrent let matchingDateComponents: DateComponents = DateComponents(month: 9) let date: Date? = calendar.nextDate( after: Date.now, matching: matchingDateComponents, matchingPolicy: .nextTime, direction: .backward ) print(zone, date) }
Post not yet marked as solved
1 Replies
I'm also really interested in this. In my app, I want to make sure locations I receive are coming from a GPS and not from Wi-Fi/Cell towers. I used to specify a desiredAccuracy to kCLLocationAccuracyBest or kCLLocationAccuracyNearestTenMeters. How can I do that again with this new API? Is that even possible? Thanks!
Post marked as solved
6 Replies
Here is a solution that works in iOS 17: import SwiftUI struct TimerTransitionView: View { var body: some View { Text(Date(timeIntervalSince1970: 1696563619), style: .timer) .contentTransition(.numericText()) .transaction { t in t.animation = .default } } } #Preview { TimerTransitionView() } Thanks LiYanan04818 for the suggestion!
Post marked as solved
6 Replies
I tried it on Xcode Version 15.0 beta 8 (15A5229m) but it does not seem to be working. My text is not animated in the app (not a widget). Do you have any idea why?
Post not yet marked as solved
1 Replies
In their sample project Sharing Core Data objects between iCloud users, Apple now covers this situation. They added some code to handle the soft deletion of objects that are duplicates. To do so, they added a deduplicatedDate property on the Tag entity, then only remove the objects after some time. See the file PersistenceController+Deduplicate.swift. They also have to filter these objects marked as deduplicated from the UI (like in the TaggingView.swift).
Post not yet marked as solved
2 Replies
Have you found an answer to your question? I have the same and I am not sure how to limit from A to A' then run some code before running the migration from A' to A". Should we specify the model version for the step to execute, then run some logic, then redo the same for another model version?
Post not yet marked as solved
2 Replies
Thanks! Sounds to answer my question. I'll make sure to add the #if DEBUG to my preview providers in packages that don't use any assets (and in the app too). I didn't know this could be used in packages too (where is the compiler flag defined for the package, like it is for a project with Active Compilation Conditions?). For the packages that need assets, I'm not sure I correctly understand: For your debug build, build this new root package from #2. And for the release build, build just the original package. Can you tell me how to use either the package from #2 or the original package in the app? In the app target, I have to import the packages needed. Do I have to create a new app target so I can import either package from #2 or the original package?
Post not yet marked as solved
1 Replies
I'm observing the same thing on an iPhone XS Max running iOS 16.1 (beta 4). I've checked many times the configuration of my app and of the CLLocationManager. It should always receive updates but sometimes, it stops. When I put the app back into foreground, the updates are received again (the app was not killed). I've not found any pattern: sometimes it happens after 5 minutes, sometimes half an hour or more. It's happening with Low Power Mode enabled and disabled. Have you found a solution?
Post not yet marked as solved
6 Replies
I'm observing the same thing on an iPhone XS Max running iOS 16.1 (beta 4). I've checked many times the configuration of my app and of the CLLocationManager. It should always receive updates but sometimes, it stops. When I put the app back into foreground, the updates are received again (the app was not killed). I've not found any pattern: sometimes it happens after 5 minutes, sometimes half an hour or more. It's happening with Low Power Mode enabled and disabled. Have anyone found a solution?