Overview

Post

Replies

Boosts

Views

Activity

SwiftUI toolbar in MacOS 15 bug ?
struct ContentView: View { var body: some View { NavigationSplitView { List { Text("row 1") Text("row 2") Text("row 3") } .toolbar(content: { ToolbarItem { Button("aa", action: onToolbar) } }) } detail: { HSplitView { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .toolbar(id: "toolbar", content: { ToolbarItem(id: "toolbar-1") { Button("bb", action: onToolbar) } }) .padding() Text("right") } }.navigationTitle("") } func onToolbar() {} } Run & Crash NSToolbar 0x6000005665b0 already contains an item with the identifier com.apple.SwiftUI.splitViewSeparator-0. Duplicate items of this type are not allowed.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
13
1
1.4k
Sep ’24
Failed to launch app in reasonable time Xcode 16
I've updated my computer to Sequoia 15, Xcode 16 and now no matter what I do, I am unable to work with Swift UI previews. I get this error each time I try to run the preview: Failed to launch app in reasonable time I have done: Uninstall/Re-install Xcode Deleted derived data Deleted the simulator data Used DevCleaner to remove all data related to Xcode Searched all websites about this issue. ( Non shown a good solution ) Write this question on here. If anyone has found a solution, please let me know how you fixed it.
15
20
6.1k
Sep ’24
SwiftData: SwiftData.PersistentIdentifierImplementation) was remapped to a temporary identifier during save
I'm seeing a lot of these in my logs: PersistentIdentifier PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(url: x-swiftdata://Course/BC9CF99A-DE6A-46F1-A18D-8034255A56D8), implementation: SwiftData.PersistentIdentifierImplementation) was remapped to a temporary identifier during save: PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(url: x-coredata:///Course/t58C849CD-D895-4773-BF53-3F63CF48935B210), implementation: SwiftData.PersistentIdentifierImplementation). This is a fatal logic error in DefaultStore ... though everything seems to work. Does anyone know what this means in this context? Anything I can do to not have this appear?
9
8
1.6k
Sep ’24
Xcode 16 | xcodebuild fails when providing -destination 'platform=iOS Simulator,name=iPhone 16,arch=x86_64'
Hello. In the Xcode 15 we were using this command in the terminal to run our tests on the Rosetta Simulator: xcodebuild -workspace CoreLibraries.xcworkspace -scheme CoreLibraries -destination 'platform=iOS Simulator,name=iPhone 15,arch=x86_64' test` In the Xcode 16 the same command doesn't work anymore. It produces the error: xcodebuild: error: Unable to find a device matching the provided destination specifier: { platform:iOS Simulator, arch:x86_64, OS:latest, name:iPhone 16 } Unsupported device specifier option. The device “iPhone 16” does not support the following options: arch Please supply only supported device specifier options. Running test directly from the Xcode UI using iPhone 16 (Rosetta) still works fine. Does anyone know how to modify the xcodebuild command to make it work again?
15
10
5.7k
Sep ’24
SwiftData crash on fetch
I have a strange crash which I have problems understanding. It only happens on a few devices, after a ModelContainer migration, and it doesn't seem to crash on the migration itself. The fetch is done in onAppear, and shouldn't necessarily result in a crash, as it is an optional try: let request = FetchDescriptor<Rifle>() let data = try? modelContext.fetch(request) if let data, !data.isEmpty { rifle = data.first(where: { $0.uuid.uuidString == settings.selectedRifleId }) ?? data.first! } When I get logs from users, there seems to be an error in encoding? Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x000000018e8bfd78 Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [71687] Triggered by Thread: 0 Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libswiftCore.dylib 0x18e8bfd78 _assertionFailure(_:_:file:line:flags:) + 264 1 SwiftData 0x24e18b480 0x24e14c000 + 259200 2 SwiftData 0x24e193968 0x24e14c000 + 293224 3 SwiftData 0x24e195a78 0x24e14c000 + 301688 4 libswiftCore.dylib 0x18e8e4084 _KeyedEncodingContainerBox.encodeNil<A>(forKey:) + 352 5 libswiftCore.dylib 0x18e8d79f0 KeyedEncodingContainer.encodeNil(forKey:) + 64 6 SwiftData 0x24e19f09c 0x24e14c000 + 340124 7 SwiftData 0x24e1a3dec 0x24e14c000 + 359916 8 libswiftCore.dylib 0x18ec10be8 dispatch thunk of Encodable.encode(to:) + 32 9 SwiftData 0x24e1cd500 0x24e14c000 + 529664 10 SwiftData 0x24e1cd0c8 0x24e14c000 + 528584 11 SwiftData 0x24e1da960 0x24e14c000 + 584032 12 SwiftData 0x24e1ee2ec 0x24e14c000 + 664300 13 SwiftData 0x24e1d97d8 0x24e14c000 + 579544 14 SwiftData 0x24e1eada0 0x24e14c000 + 650656 15 SwiftData 0x24e1d989c 0x24e14c000 + 579740 16 SwiftData 0x24e1eee78 0x24e14c000 + 667256 17 Impact 0x1027403bc 0x10268c000 + 738236
9
3
625
Oct ’24
Set date and time in iOS Simulator
I am trying to fix a bug in my iOS app that is dependent upon date and time. Is there any way to set the actual time on the iOS Simulator to a specific date and time? I know that you can set one for the status bar, but that doesn't affect the actual date and time that is reported by the system to apps.
3
3
3.9k
Oct ’24
FSKit questions and clarifications
I work on EdenFS, an open-source Virtual Filesystem that runs on macOS, Linux, and Windows. My team is very interested in using FSKit as the basis for EdenFS on macOS, but have found the documentation to be lacking and contains some mixed messaging on the future of FSKit. Below are a few questions that don’t seem to be fully covered by the current documentation: Does FSKit support process attribution? Each FUSE request provides a requester Process ID (and other information) through the fuse_in_header structure. Does FSKit pass similar information along for each request? Does the reclaimItem API function similarly to FUSE’s forget operation? If not, what are the differences? See #1 below for why forget/reclaimItem matters to us. Is Apple committed to releasing and supporting FSKit? Is there any timeline for release that we can plan around? Does FSKit have known performance/scalability limitations? We provide alternative methods that clients can use to make bulk requests to EdenFS, but some clients will necessarily be unable to use those and stress the default filesystem APIs. Throughput (on the order of tens of thousands of filesystem requests per minute) and request size are the main concerns, followed closely by directory size restrictions. Why we’re interested in FSKit As mentioned above, my team supports EdenFS on 3 platforms. On Linux, we utilize FUSE; on Windows, we utilize ProjectedFS; and on macOS, we’ve utilized a few different solutions in the past. We first utilized the macFUSE kext, which was great while it lasted. Due to (understandable) changes in supporting kernel extensions, we were forced to move to NFS version 3. NFS has been lackluster in comparison (and our initial investigations show that NFS version 4(.2) would be similar). We have had numerous scalability and reliability issues, some listed below: NFS does not provide a forget API similar to FUSE. EdenFS is forced to remember all file handles that have been loaded because the kernel never informs us when all references to that file handle have been dropped. We can hackily infer that a file handle should never be referenced again in some cases, but a large number of file handles end up being remembered forever. Many of our algorithms scale with the number of file handles that Eden has to consider, and therefore performance issues are inevitable after some time. NFS does not provide information about clients (requesters). We cannot tell which processes are sending EdenFS requests. This attribution is important due to issue #1. We are forced to work with tool owners to modify their applications to be VFS-friendly. If we can’t track down which tools are behaving poorly, they will continue to load excess file handles and cause performance issues. NFS “Server connections interrupted:” dialog during heavy load. Under heavy load, either EdenFS or system-wide, our users experience this dialog pop-up and are confused as to how they should respond (Ignore or Disconnect All). They become blocked in their work, and will be further blocked if they click “Disconnect All” as that unmounts their EdenFS mount. This forces them to restart EdenFS or reboot their laptop to remediate the issue. The above issues make us extremely motivated to use FSKit and partner with Apple to flesh out the final version of the FSKit API. Our use case likely mirrors what other user-space filesystems will be looking for in the FSKit API (albeit at a larger scale than most), and we’re willing to collaborate to work out any issues in the current FSKit offerings.
4
0
1.5k
Oct ’24
Stands not detected
I have FB12696743 open since July 21, 2023 and this happened again today. I get home at approx 10 mins after the hour, walk appox 50 ft across my yard, up 5 steps into my house, let the dog out and pace on my deck watching the dog, go back in the house walk around the kitchen while preparing dinner. A total of about 200 ft. I sit down about 35 past the hour and start to eat and at 10 mins to the next our and I get the reminder to stand. On the other side I wake up at 5 mins to hour. Walk 8 steps to the bathroom and successfully achieve the stand for that hour. WHY!?!?!? 😁🤣
1
1
452
Oct ’24
AreaMark Always alignsMarkStylesWithPlotArea for linear gradients
I'm trying to make a Swift Chart where 24 AreaMarks an hour apart on X axis over a day display a vertical gradient. The gradient is vertical and is essentially [Color.opacity(0.1),Colour,Color.opacity(0.1] The idea here is where the upper and lower points of each AreaMark are the same or close to each other in the Y axis, the chart essentially displays a line, where they are far apart you get a nice fading vertical gradient. However, it seems that the .alignsMarkStylesWithPlotArea modifier is always set for AreaMarks even if manually applying it false. Investigating further, I've learnt that with AreaMarks in a series, Swift Charts seems to only listen to the first foreground style set in. I've created some sample code to demonstrate this. struct DemoChartView: View { var body: some View { Chart { AreaMark(x: .value("Time", Date().addingTimeInterval(0)), yStart: .value("1", 40), yEnd: .value("2", 60)) .foregroundStyle(LinearGradient(colors: [.pink, .teal], startPoint: .top, endPoint: .bottom)) .alignsMarkStylesWithPlotArea(false) AreaMark(x: .value("Time", Date().addingTimeInterval(3600)), yStart: .value("1", 44), yEnd: .value("2", 58)) .foregroundStyle(LinearGradient(colors: [.orange, .yellow], startPoint: .top, endPoint: .bottom)) .alignsMarkStylesWithPlotArea(false) AreaMark(x: .value("Time", Date().addingTimeInterval(03600*2)), yStart: .value("1", 50), yEnd: .value("2", 90)) .foregroundStyle(LinearGradient(colors: [.green, .blue], startPoint: .top, endPoint: .bottom)) .alignsMarkStylesWithPlotArea(false) } } } Which produces this: So here, all the different .foregroundStyle LinearGradients are being ignored AND the .alignsMarkStylesWithPlotArea(false) is also ignored - the amount of pink on the first mark is different to the second and third 🤷‍♂️ Has anyone encountered this. Are AreaMarks the correct choice or are they just not setup to create this type of data display. Thanks
3
0
674
Oct ’24
Peripheral Devices control on macOS
We are looking for a solution (API, Frameworks) that would allow us to block any type of external device, including storage devices, HIDs, network adapters, and Bluetooth devices according with dynamic rules that comes from management server . This feature is important for endpoint security solutions vendors, and it can be implemented on other platforms and older versions of macOS using the IOKit framework and kexts. I have found one solution that can control the usage only of "storage" devices with the EndpointSecurity framework in conjunction with the DiskArbitration framework. This involves monitoring the MOUNT and OPEN events for /dev/disk files, checking for devices as they appear, and ejecting them if they need to be blocked.. Also, I have found the ES_EVENT_TYPE_AUTH_IOKIT_OPEN event in EndpointSecurity.framework, but it doesn't seem to be useful, at least not for my purposes, because ES doesn't provide AUTH events for some system daemons, such as configd (it only provides NOTIFY events). Furthermore, there are other ways to communicate with devices and their drivers apart from IOKit. DriverKit.framework does not provide the necessary functionality either, as it requires specific entitlements that are only available to certain vendors and devices. Therefore, it cannot be used to create universal drivers for all devices, which should be blocked. Any advice would be greatly appreciated!
2
0
603
Oct ’24
Crash in iOS 18 regarding [AVPlayerController _observeValueForKeyPath:oldValue:newValue:]
There are significant crash reports coming from iOS 18 users regarding AVKit framework that starts from this line [AVPlayerController _observeValueForKeyPath:oldValue:newValue:] which seems to be coming from iOS internal SDK. There are 2 kinds of crash we found: UI modification on background thread From the stack trace it seems like when AVPictureInPictureController is being deallocated and its view is being removed from superview somehow the code is being executed in background thread because there is this line there _AssertAutoLayoutOnAllowedThreadsOnly highlighted before the crash. But I’ve checked our code that plays around AVPictureInPictureController, in the locations where we would deallocate the object it will always be called on main thread which are insideviewDidLoad and deinit inside UIViewController class. From the log, it seems like the crash happened when user try to open another content when PIP player is active resulting in the current PIP instance will be replaced with a new one. My suspect is the observation logic inside AVPlayerController could be the hint to this issue, probably something broken over there since this issue happened across our app versions on iOS 18 users only. Unfortunately, I was unable to reproduce this issue yet but one of my colleagues reproduced it once but haven’t been able to do it again since. The reports keep raising each day up to 1.3k events in the last 30 days now. Over release object This one has lower reports than the first one but I decided to include it since it might have relevant information regarding the first crash since the starting stack trace is similar. The crash timing seems to be similar to the first one, where we deallocate existing AVPictureInPictureController and later replace it with a new one and also found only in iOS 18 users which also refers to [AVPlayerController _observeValueForKeyPath:oldValue:newValue:]. I also was unable to reproduce this issue so far. Oh, and both of the issues happened on both iPhone and iPad. We’d appreciate any advice on what we can do to avoid this in the future and probably any hint on why it could happened. I have reported this issue with bug number: FB15620734 I also attached one sample crash report for each of the crashes here. non ui thread access.crash over release.crash
9
13
1.9k
Oct ’24
WorkoutKit WorkoutScheduler sync Broken with iOS 18.2 beta
WorkoutKit WorkoutScheduler seems broken with the first beta of iOS 18.2. I have tested using my app from Xcode and the one that is on the App Store (and working properly on other devices), and it's not working with this new beta of iOS. They appears in WorkoutScheduler.shared.scheduledWorkouts, but not on the watch. I even tried with other apps that do the same with Manual add to Apple Watch with SwiftUI workoutPreview work. Xcode 16.0 iOS 18.2 Beta 1 WatchOS 11.1
24
5
1.4k
Nov ’24
Landscape safe area is incorrect when presenting SKStoreProductViewController
Hi. If the app is in landscape only and when the SKStoreProductViewController is presented, the safeArea changes to what looks like a portrait mode safe area. When the SKStoreProductViewController is dismissed, the safeArea does NOT revert back to the original values. Is there a way to force the safeArea to "reset"? I've submitted some bug tickets through Apple Feedback but I haven't received any response about it. The below code will pop up the SKStoreProductViewController and if you have a UIView that is constrained to the safe area, then you can visibly notice that the safe area is changed and doesn't go back. I have tested this on iPhone 14 Pro, iPhone 15, and iPhone 16 Pro and in the Simulators. The incorrect behavior happens on those and probably more. Thanks. #import "ViewController.h" #import &amp;lt;StoreKit/StoreKit.h&amp;gt; @interface ViewController () @property (nonatomic, strong) SKStoreProductViewController *productViewController; @end @implementation ViewController - (IBAction)buttonTapped:(id)sender { self.productViewController = [[SKStoreProductViewController alloc] init]; NSDictionary *parameters = @{ @"id" : @"6443575749" }; [self.productViewController loadProductWithParameters:parameters completionBlock:^(BOOL result, NSError * _Nullable error) { [self presentViewController:self.productViewController animated:YES completion:^{ // presented // The panel that is constraint to the safe area visibly shows that the safe area is no longer correct. }]; }]; } @end
3
1
614
Nov ’24
New linker in Command Line Tools 16 not working with BLOCK DATA
We've encountered a critical issue with the new linker of CLT16 (version 16.1.0.0.1.1729049160) that prevents proper initialization of BLOCK DATA. BLOCK DATA are used to initialize global variables in our Fortran code, and its failure to initialize those variables leads to a program crash. This affects our community of more that thousand scientists worldwide. The current workaround is using the -ld_classic linker option. However, this option is deprecated and will be removed in a future release, as described in the Xcode release note. I've attached a minimal example that reproduces the problem using GNU gfortran with the following instructions (the attached main.f.txt and bd.f.txt need to be rename to main.f and bd.f, respectively): gfortran -c bd.f gfortran -c main.f ar rv libtest.a bd.o main.o gfortran -ld_classic -o good.x -L. libtest.a gfortran -o bad.x -L. libtest.a Running the two programs, one can see that the BLOCK DATA are not initialised without the option ld_classic, $ > ./good.x 3.7273802569289098 2.8083922366048202 $ > ./bad.x 0.0000000000000000 0.0000000000000000 We kindly request your attention to this matter and a prompt solution or alternative workaround. Best regards main.f.txt bd.f.txt part.txt
1
1
408
Nov ’24
PHLivePhotoEditingContext.saveLivePhoto results in AVFoundation error -11800 "The operation could not be completed" reason An unknown error occurred (-12815)
When trying to edit some Live Photos, calling PHLivePhotoEditingContext.saveLivePhoto results in the following error: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-12815), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x300d05380 {Error Domain=NSOSStatusErrorDomain Code=-12815 "(null)"}} I was able to replicate it on my device by taking a new Live Photo. Not sure what's wrong with that one specifically, not all Live Photos replicate the issue. I've submitted FB15880825 with a sysdiagnose and a Photos Diagnostics as well. Any ideas what's going on here? It's impacting multiple customers. Thanks!
1
0
515
Nov ’24
Dock tile plugin and app groups
In one of my apps I use an app group to share data between the app and a command line tool. This works as expected. The app also contains a Dock Tile plugin and I wonder if there's a way to access the group container from this plugin? Thanks in advance for your help. Best regards, Marc
5
0
348
Dec ’24
Animated Custom Transitions Crash using Swift 6
When you apply an animation to a custom Transition in Swift 6, it is likely that that the app will crash with a SwiftUI.AsyncRenderer dispatch_assert_queue_fail error. Non-animated Transitions do not crash nor do animated system transitions. If you use ViewModifiers to create an AnyTransition with the .modifier(active:, identity:) static method, there is no problem. I used the example Transition in the docs for Transition to illustrate this problem. I'm using Xcode 16.2 RC and Swift 6, running iOS 18.1.1 on an iPhone 16 Pro. I've created two separate Previews that illustrate what specifically crashes the app and what doesn't as well as a workaround for this bug. func generateRandomString() -> String { let characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" return String((0..<10).compactMap { _ in characters.randomElement() }) } // MARK: Works extension AnyTransition { struct RotatingFadeTransitionModifier: ViewModifier { let opacity: CGFloat let rotation: Angle func body(content: Content) -> some View { content .opacity(opacity) .rotationEffect(rotation) } } static var rotatingFade: AnyTransition { .asymmetric( insertion: .modifier( active: RotatingFadeTransitionModifier(opacity: 0, rotation: .degrees(30)), identity: RotatingFadeTransitionModifier(opacity: 1, rotation: .zero) ), removal: .modifier( active: RotatingFadeTransitionModifier(opacity: 0, rotation: .degrees(-30)), identity: RotatingFadeTransitionModifier(opacity: 1, rotation: .zero) ) ) } } struct WorkingTransitionView: View { @State private var text: String = "some string" var body: some View { VStack(spacing: 32) { Text("system transition: \(text)") .id(text) .transition(.slide) // Gets the explicit Button animation applied instead of // the transition animation Text("animated system transition: \(text)") .id(text) .transition(.slide.animation(.bouncy(duration: 0.5))) Text("custom transition: \(text)") .id(text) .transition(.rotatingFade) Text("animated custom transition: \(text)") .id(text) .transition(.rotatingFade.animation(.bouncy( extraBounce: 0.5))) Button("animated randomize - safe") { withAnimation(.smooth(duration: 5.45, extraBounce: 0.15)) { text = generateRandomString() } } } } } // MARK: Crashes struct RotatingFadeTransition: Transition { func body(content: Content, phase: TransitionPhase) -> some View { content .opacity(phase.isIdentity ? 1.0 : 0.0) .rotationEffect(phase.rotation) } } extension TransitionPhase { fileprivate var rotation: Angle { switch self { case .willAppear: .degrees(30) case .identity: .zero case .didDisappear: .degrees(-30) } } } struct CrashingTransitionView: View { @State private var text: String = "some string" @State private var presentCustomTransitionText: Bool = false @State private var presentAnimatedCustomTransitionText: Bool = false var body: some View { VStack(spacing: 32) { Text("on 1-5 attempts generally, animated custom Transitions will crash with a SwiftUI.AsyncRenderer dispatch_assert_queue_fail") Divider() textWithSafeSystemTransition if presentCustomTransitionText { textWithCustomTransition } if presentAnimatedCustomTransitionText { textWithAnimatedCustomTransition } Divider() Text("Randomization") Button("randomize - won't crash non-animated custom transition text") { text = generateRandomString() } Button("animated randomize - will crash any custom transition text") { withAnimation(.smooth(duration: 0.45, extraBounce: 0.15)) { text = generateRandomString() } } Divider() Text("Text Presentation") Button("present non-animated custom transition text") { presentCustomTransitionText = true } Button("present animated custom transition text") { presentAnimatedCustomTransitionText = true } } } private var textWithSafeSystemTransition: some View { Text("safe, system transition: \(text)") .id(text) .transition(.slide) } private var textWithCustomTransition: some View { Text("safe text, custom transition: \(text)") .id(text) .transition(RotatingFadeTransition()) } private var textWithAnimatedCustomTransition: some View { Text("crashing text: \(text)") .id(text) .transition(RotatingFadeTransition().animation(.smooth)) } } #Preview("Working Code") { WorkingTransitionView() } #Preview("Crashing Code") { CrashingTransitionView() }
3
1
431
Dec ’24
button is pressed when starting scrolling in iOS 18
On iOS 18, while on a modal screen, if the scrolling starts on a button, that button gets pressed, outside of a modal this doesn't reproduce, also not reproducible on older iOS versions, neither on modals or outside of them. The code to reproduce the issue: import SwiftUI struct ContentView: View { @State var presentModal = false var body: some View { Button(action: { presentModal = true }, label: { Text("open modal") }) .sheet(isPresented: $presentModal, content: { ScrollView { ForEach(0..<100, id: \.self) { index in Button(action: { print("Button \(index) tapped!") }) { Text("Button \(index)") .frame(maxWidth: .infinity) .frame(height: 100) .background(randomColor(for: index)) .padding(.horizontal) } } } }) } func randomColor(for index: Int) -> Color { let hue = Double(index % 100) / 100.0 return Color(hue: hue, saturation: 0.8, brightness: 0.8) } } #Preview { ContentView() }
7
6
560
Dec ’24