Build, test, and submit your app using Xcode, Apple's integrated development environment.

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

Xcode 27 How do we declare the accent color?
Hi guys In Xcode 27, we have to create the Assets Catalog file ourselves. This file is empty. The icon now is generated by Icon Composer, but how do you specify the accent color? I tried creating a Color set with the name AccentColor but didn't work. And look for options in the project settings but couldn't find any.
1
0
111
1w
ibtool omits "Estimate Size: Automatic" from compiled nibs when deployment target is iOS 17+
I found that Xcode 26.1.1 (17B100) silently disables UICollectionView self-sizing configured in Interface Builder, depending on the minimum deployment target. I've fixed this issue in my project by explicitly setting the estimatedItemSize to UICollectionViewFlowLayout.automaticSize, but I was wondering whether this is intended behavior, or am I missing something? When a XIB contains a UICollectionViewFlowLayout with Estimate Size: Automatic (automaticEstimatedItemSize="YES" in the document source): <collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" automaticEstimatedItemSize="YES" minimumLineSpacing="6" minimumInteritemSpacing="6"> <size key="itemSize" width="128" height="32"/> </collectionViewFlowLayout> ibtool drops the estimated-size key from the compiled nib if IPHONEOS_DEPLOYMENT_TARGET is 17.0 or later. It can be confirmed by compiling the same XIB at two deployment targets: $ ibtool --target-device iphone --minimum-deployment-target 16.0 --compile out16.nib View.xib $ strings out16.nib | grep -i estimat estimatedItemSize # present $ ibtool --target-device iphone --minimum-deployment-target 17.0 --compile out17.nib View.xib $ strings out17.nib | grep -i estimat # (nothing - key is gone) At runtime the flow layout decodes estimatedItemSize = .zero, so self-sizing is silently disabled and every cell is laid out at the placeholder Cell Size (128x32 above), regardless of its content: decoded estimatedItemSize = (0.0, 0.0), itemSize = (128.0, 32.0) // target 17.0 decoded estimatedItemSize = (1.79e+308, 1.79e+308) // target 16.0, works This is independent of the runtime OS version — I reproduced it on iOS 18.4 and iOS 26.1 simulators. The information is simply missing from the compiled nib, and no build warning or error is emitted. Confusingly, UIKit still calls the cell's preferredLayoutAttributesFitting(_:), so cells appear to compute correct sizes; they are just never adopted by the layout, which makes this quite hard to debug. Workaround — set it in code after the nib loads (the XIB cannot be fixed at the source level because the attribute is dropped at compile time): (collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.estimatedItemSize = UICollectionViewFlowLayout.automaticSize I attached minimal reproduction project (toggle IPHONEOS_DEPLOYMENT_TARGET between 16.0 and 17.0 to see both behaviors) to the feedback filed as FB23526517
0
0
58
2w
QR code scan deeplink not work in XCode test run?
Hi, I'm trying to figure out what is true here - if I am not in the correct forum please direct me :-) A. It is not possible to test a QR code scan that contains a deeplink into my iOS app from an XCoode build test run. In other words, The build must be published to Test Flight for the iOS's QR code scan sub-system to be able to process the deeplink into my app? If I am wrong about this, it sure would help with testing to be able to test directly from the local XCode build test. If so, can someone point me in the direction of what I would need to do for that? Thanks for your input either way!
1
0
290
2w
Xcode 27 release notes mention that the minimum deployment target is macOS 11.0, but Xcode itself says that only macOS 12.0 to 27.0 are supported
The release notes at https://developer.apple.com/documentation/xcode-release-notes/xcode-27-release-notes mention that the minimum deployment target is macOS 11.0, but Xcode itself says that only macOS 12.0 to 27.0 are supported. Which one is correct, Xcode or the release notes? I created FB23514411.
0
0
106
2w
Xcode 26, how to uncheck "Connect via network" for physical device?
This forced network connection severely affects the development efficiency. No matter how you implement communication, when you plug in a USB device, you must and definitely prioritize using USB. If you always use the network or rely on the mobile network card, it will interfere with the efficiency of the policy for connecting via the mobile network. When there are many people in our company sharing a Wi-Fi network and it is already very slow, it is impossible to debug this, which is extremely annoying. Why do you have to prohibit developers from setting whether to debug through USB or the network? You can't figure it out because your network is fast. When your network is congested, it is completely unusable. Why not let them choose for themselves? I don't understand why you have to hide this switch. It is very stupid.
0
0
52
2w
DriverKit target in iPad app, missing libclang_rt.profile_driverkit.a
I'm trying to build the DriverKit template driver target in an Xcode project which contains an app targeting iPadOS 17. I've made no modifications to the DriverKit template. When building, I get this link error ld: file cannot be open()ed, errno=2 path=/Applications/Xcode 15.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.profile_driverkit.a in '/Applications/Xcode 15.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.profile_driverkit.a' anyone know how to fix this? My search turned up something about building llvm from sources, which seems like overkill to put a DriverKit driver into an iPad app.
5
2
2.1k
2w
Xcode 27 How to specify the bundle Identifier
Xcode 27 creates a placeholder for the bundle identifier of a new project. devplaceholder.$(PROJECT_UNIQUE_VALUE:identifier).$(PRODUCT_NAME:identifier) I have two questions. Is it enough to change the bundle id from the Signing & Capabilities panel or do we need to change it somewhere else? What are Apple recommendations? Should we only replace the devplaceholder value and keep the unique value and product name, provide our won id but keep the product name, or replace everything with our own bundle ID? Thanks
2
0
181
2w
Xcode RAM Usage Problem
👋🏻 Hello Apple Developer Community, I’ve recently got the problem with the current Xcode Beta Version and the Preview Feature. Because when I try to load the Preview, the RAM Usage spikes and it’s nearly at the limit on my MacBook (16GB RAM). (Note: This is happening while loading up the Preview) But when I haven’t loaded the Preview Window, the overall RAM Usage of my system is ver low (Note: This is when Xcode has is not loading the Preview) (Note: This is after quitting Xcode for cancelling the load of the Preview) All Pictures are in German, sorry for that ☹️. What are possible problems or solutions against this problem? Have a nice day / evening 😁
1
0
162
2w
Unable to run App Shortcut: App Shortcuts cannot run on iOS Simulator 26.5 through 27.0 beta 2
App Shortcuts cannot be debugged or executed on iOS Simulator runtimes from iOS 26.5 through iOS 27.0 beta 2 when using Xcode 26.5 through Xcode 27 beta 2. When attempting to run an App Shortcut in the Shortcuts app on the simulator, Shortcuts shows the error: Unable to run App Shortcut The simulator console logs the following error: Attempted to fetch Auto Shortcuts, but couldn't find the AppShortcutsProvider This happens even with Apple’s official App Intents sample project, so it does not appear to be specific to a third-party app implementation. Steps to Reproduce Download Apple’s official sample project from: https://developer.apple.com/documentation/appintents/acceleratingappinteractionswithappintents Open the sample project in Xcode 26.5 through Xcode 27 beta 2. Build and run the app on an iOS Simulator using iOS 26.5 through iOS 27.0 beta 2. Open the Shortcuts app in the simulator. Find one of the sample app’s App Shortcuts. Try to run the App Shortcut. Expected Result The App Shortcut should run successfully in the iOS Simulator, allowing App Shortcuts and App Intents to be debugged during development. Actual Result The Shortcuts app displays: Unable to run App Shortcut The simulator console logs: Attempted to fetch Auto Shortcuts, but couldn't find the AppShortcutsProvider The App Shortcut cannot be executed or debugged in the simulator. Reproducibility Reproduces consistently. Tested Configurations Xcode 26.5 with iOS Simulator 26.5 Xcode 27 beta 2 with iOS Simulator 27.0 beta 2
1
0
86
2w
Paired Apple Watch never appears in Xcode Devices & Simulators, Developer Mode toggle missing on watchOS
I'm blocked trying to run/debug an app on a physical Apple Watch. The iPhone connects to Xcode perfectly over USB and is fully trusted, but the paired Watch never shows up in Xcode, and because of that the Developer Mode toggle never appears on the watch itself. Environment Mac: MacOS 26.4 Xcode: 26.5 iPhone: iPhone 17, iOS 26.4 — connected to Mac via USB, trusted Apple Watch: Ultra 3, watchOS 26.3 Developer Mode: enabled on iPhone Watch is paired and working normally in the iPhone Watch app What happens In Xcode → Window → Devices and Simulators, only the iPhone ("Brian") shows under Connected, with its installed apps listed correctly. The paired Apple Watch does not appear under it or as a separate entry. On the watch, Settings → Privacy & Security has no Developer Mode item. I understand this only surfaces after Xcode successfully connects to the watch, so I believe the missing Xcode connection is the root cause. When I first connected the iPhone via cable, a Trust prompt did appear on the watch and I accepted it. What I've already tried Enabled Developer Mode on iPhone (toggled off/on, with restarts) Connected iPhone via USB and confirmed Trust on both iPhone and watch Restarted Mac, iPhone, and watch multiple times Confirmed Bluetooth and Wi-Fi are on across all three devices Kept the watch unlocked and on my wrist, close to the iPhone and Mac Despite this, the watch never appears in Xcode and the Developer Mode toggle never surfaces on watchOS. Questions Is this the known Xcode 26 / watchOS 26 tunneling/discovery regression, or is something else going on in my setup? Is there an Apple-supported way to force Xcode to re-discover a paired watch without unpairing it from the iPhone? Has any specific combination of macOS / Xcode / watchOS versions reliably resolved this for anyone? Any guidance appreciated. Happy to file a Feedback Assistant report and share the ID if useful.
1
0
116
2w
Could not find library with name ”/usr/lib/swift/libswiftWebKit.dylib“
Canvas Previews (targeting macOS) in both Xcode 16.4 & Xcode 26 fail to load, when the project imports a Swift package that imports and uses WebKit. I'm on macOS 15.5. Tried also to bring minimum targets of both the project and the package to 15.0. I see that there are some work-arounds for iOS simulator but nothing for the Mac. Anyone facing the same problem?
6
0
404
2w
Xcode 27: Bugs / Feedbacks
Hi, I have listed below the Feedbacks for Xcode 27, please have a look at it, considerable time was spent on filing these feedbacks, thanks! Environments All of them were tested on the environment: macOS 26.5.1 (25F80) Xcode 27.0 beta (27A5194q) Feedbacks FB23133706 (Git stage tab) FB23132869 (markdown - code block) FB23132403 (markdown - search) FB23078039 (stash - slow / unresponsive) FB23077930 (stash - allow multiselection) FB23055381 (Run destination - Clear recents) FB23041713 (SwiftUI preview - SwiftData) FB23033844 (Bundle ID) FB23033231 (Device Hub - sizes)
10
1
659
2w
Unable to sign into sandbox account on simulator / device hub
Hi, I am unable to sign into the sandbox account on the simulator. Settings > Developer > Sandbox Apple Account > Sign in Xcode: 26.6 (17F113) Xcode Simulator: 16.0 (1063.4) I have even tried on Device Hub on Xcode 27. I vaguely remember being able to sign into the simulator using Questions: Is anyone able to sign into Sandbox account on the simulator / device hub? Is there any workaround? Is this a known issue?
0
0
102
2w
Implementing Your Own Crash Reporter
I often get questions about third-party crash reporting. These usually show up in one of two contexts: Folks are trying to implement their own crash reporter. Folks have implemented their own crash reporter and are trying to debug a problem based on the report it generated. This is a complex issue and this post is my attempt to untangle some of that complexity. IMPORTANT iOS 27, currently in beta, introduced support for out-of-process crash reporting using the CrashReportExtension framework. I haven’t yet had time to update this post to cover that technology. However, if you’re planning to implement your own crash reporter on iOS, you should start there. (The documentation currently states that this feature is available on macOS 27, also currently in beta, but that’s not true (r. 180425854) and I’ve no info to share as to when that’ll change.) If you have a follow-up question about anything I've raised here, please put it in a new thread with the Debugging tag. IMPORTANT All of the following is my own direct experience. None of it should be considered official DTS policy. If you have a specific question that needs a direct answer — perhaps you’re trying to convince your boss that implementing your own crash reporter is a very bad idea — start a dedicated thread here on the forums and we can discuss the details there. Use whatever subtopic is appropriate for your issue, but make sure to add the Debugging tag so that I see it go by. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" Scope First, I can only speak to the technical side of this issue. There are other aspects that are beyond my remit: I don’t work for App Review, and only they can give definitive answers about what will or won’t be allowed on the store. Implementing your own crash reporter has significant privacy implications. IMPORTANT If you implement your own crash reporter, discuss the privacy impact with a lawyer. This post assumes that you are implementing your own crash reporter. A lot of folks use a crash reporter from another third party. From my perspective these are the same thing. If you use a custom crash reporter, you are responsible for its behaviour, both good and bad, regardless of where the actual code came from. Note If you use a crash reporter from another third party, run the tests outlined in Preserve the Apple Crash Report to verify that it’s working well. General Advice I strongly advise against implementing your own crash reporter. It’s very easy to create a basic crash reporter that works well enough to debug simple problems. It’s impossible to implement a good crash reporter, one that’s reliable, binary compatible, and sufficient to debug complex problems. The bulk of this post is a low-level explanation of that impossibility. Rather than attempting the impossible, I recommend that you lean in to Apple’s crash reporter. In recent years it’s acquired some really cool new features: If you’re creating an App Store app, the Xcode organiser gives you easy, interactive access to Apple crash reports. If you’re an enterprise developer, consider switching to Custom App Distribution. This yields all the benefits of App Store distribution without your app being generally available on the store. iOS 14 and macOS 12 report crashes in MetricKit. This is a very cool feature, and I’m surprised by how few people use it effectively. If you previously dismissed Apple crash reports as insufficient, I encourage you to reconsider that decision. Why Is This Impossible? Earlier I said “It’s impossible to implement a good crash reporter”, and I want to explain why I’m confident enough in my conclusions to use that specific word. There are two fundamental problems here: On iOS (and the other iOS-based platforms, watchOS and tvOS) your crash reporter must run inside the crashed process. That means it can never be 100% reliable. If the process is crashing then, by definition, it’s in an undefined state. Attempting to do real work in that state is just asking for problems [1]. To get good results your crash reporter must be intimately tied to system implementation details. These can change from release to release, which invalidates the assumptions made by your crash reporter. This isn’t a problem for the Apple crash reporter because it ships with the system. However, a crash reporter that’s built in to your product is always going to be brittle. I’m speaking from hard-won experience here. I worked for DTS during the PowerPC-to-Intel transition, and saw a lot of folks with custom crash reporters struggle through that process. Still, this post exists because lots of folks ignore this reality, so the subsequent sections contain advice about specific technical issues. WARNING Do not interpret any of the following as encouragement to implement your own crash reporter. I strongly advise against that. However, if you ignore my advice then you should at least try to minimise the risk, which is what the rest of this document is about. [1] On macOS it’s possible for your crash reporter to run out of process, just like the Apple crash reporter. However, possible is not the same as easy. In fact, running out of process can make things worse: It prevents you from geting critical state for the crashed process without being tightly bound to OS implementation details. It would be nice if Apple provided APIs for this sort of thing, but that’s currently not the case. Preserve the Apple Crash Report You must ensure that your crash reporter doesn’t disrupt the Apple crash reporter. This is important for three reasons: Some fraction of your crashes will not be caused by your code but by problems in framework code, and accurate Apple crash reports are critical in diagnosing such issues. When dealing with really hard-to-debug problems, you need the more obscure info that’s shown in the Apple crash report. If you’re working with someone from Apple (here on the forums, via a bug report, or a DTS case, or whatever), they’re going to want an accurate Apple crash report. If your crash reporter is disrupting the Apple crash reporter — either preventing it from generating crash reports entirely [1], or distorting those crash reports — that limits how much they can help you. IMPORTANT This is not a theoretical concern. The forums have many threads where I’ve been unable to help folks debug a gnarly problem because their third-party crash reporter didn’t preserve the Apple crash report (see here, here, and here for some examples). To avoid these issues I recommend that you test your crash reporter’s impact on the Apple crash reporter. The basic idea is: Create a program that generates a set of specific crashes. Run through each crash. Verify that your crash reporter produces sensible results. Verify that the Apple crash reporter produces the same results as it does without your crash reporter With regards step 1, your test suite should include: An un-handled language exception thrown by your code An un-handled language exception thrown by the OS (accessing an NSArray out of bounds is an easy way to get this) Various machine exceptions (at a minimum, memory access, illegal instruction, and breakpoint exceptions) Stack overflow Make sure to test all of these cases on both the main thread and a secondary thread. With regards step 4, check that the resulting Apple crash report includes correct values for: The exception info The crashed thread That thread’s state Any application-specific info, and especially the last exception backtrace [1] A particularly pathological behaviour here is to end your crash reporter by calling exit. This completely suppresses the Apple crash report. Some third-party language runtimes ‘helpfully’ include such a crash reporter, which makes it very hard to debug problems that occur within your process but outside of that language. Signals Many third-party crash reporters use UNIX signals to catch the crash. This is a shame because using Mach exception handling, the mechanism used by the Apple crash reporter, is generally a better option. However, there are two reasons to favour UNIX signals over Mach exception handling: On iOS-based platforms your crash reporter must run in-process, and doing in-process Mach exception handling is not feasible. Folks are a lot more familiar with UNIX signals. Mach exception handling, and Mach messaging in general, is pretty darned obscure. If you use UNIX signals for your crash reporter, be aware that this API has some gaping pitfalls. First and foremost, your signal handler can only use async signal safe functions [1]. You can find a list of these functions in sigaction man page [2] [3]. WARNING This list does not include malloc. This means that a crash reporter’s signal handler cannot use Objective-C or Swift, as there’s no way to constrain how those language runtimes allocate memory [4]. That means you’re stuck with C or C++, but even there you have to be careful to comply with this constraint. The Operative: It’s worse than you know. Captain Malcolm Reynolds: It usually is. Many crash reports use functions like backtrace (see its man page) to get a backtrace from their signal handler. There’s two problems with this: backtrace is not an async signal safe function. backtrace uses a naïve algorithm that doesn’t deal well with cross signal handler stack frames [5]. The latter point is particularly worrying, because it hides the identity of the stack frame that triggered the signal. If you’re going to backtrace out of a signal, you must use the crashed thread’s state (accessible via the handlers uap parameter) to start your backtrace. Apropos that, if your crash reporter wants to log the state of the crashed thread, that’s the place to get it. Your signal handler must be prepared to be called by multiple threads. A typical crashing signal (like SIGSEGV) is delivered to the thread that triggered the machine exception. While your signal handler is running on that thread, other threads in your process continue to run. One of these threads could crash, causing it to call your signal handler. It’s a good idea to suspend all threads in your process early in your signal handler. However, there’s no way to completely eliminate this window. Note The need to suspend all the other threads in your process is further evidence that sticking to async signal safe functions is required. An unsafe function might depend on a thread you’ve suspended. A typical crashing signal is delivered on the thread that triggered the machine exception. If the machine exception was caused by a stack overflow, the system won’t have enough stack space to call your signal handler. You can tell the system to switch to an alternative stack (see the discussion of SA_ONSTACK in the sigaction man page) but that isn’t a complete solution (because of the thread issue discussed immediately above). Finally, there’s the question of how to exit from your signal handler. You must not call exit. There’s two problems with doing that: exit is not async signal safe. In fact, exit can run arbitrary code via handlers registered with atexit. If you want to exit the process, call _exit. Exiting the process is a bad idea anyway, because it will prevent the Apple crash reporter from running. This is very poor form. For an explanation as to why, see Preserve the Apple Crash Report (above). A better solution is to unregister your signal handler (set it to SIG_DFL) and then return. This will cause the crashed process to continue execution, crash again, and generate a crash report via the Apple crash reporter. [1] While the common signals caught by a crash reporter are not technically async signals (except SIGABRT), you still have to treat them as async signals because they can occur on any thread at any time. [2] It’s reasonable to extend this list to other routines that are implemented as thin shims on a system call. For example, I have no qualms about calling vm_read (see below) from a signal handler. [3] Be aware, however, that even this list has caveats. See my Async Signal Safe Functions vs Dyld Lazy Binding post for details. [4] I expect that it’ll eventually be possible to write signal handlers in Swift, possibly using some facility that evolves from the the existing, but unsupported, @_noAllocation and @_noLocks attributes. If you’d like to get involved with that effort, I recommend that engage with the Swift Evolution process. [5] Cross signal handler stack frames are pushed on to the stack by the kernel when it runs a signal handler on a thread. As there’s no API to learn about the structure of these frames, there’s no way to backtrace across one of these frames in isolation. I’m happy to go into details but it’s really not relevant to this discussion [6]. If you’re interested, start a new thread with the Debugging tag and we can chat there. [6] (Arg, my footnotes have footnotes!) The exception to this is where your trying to generate a crash report for code running in a signal handler. That’s not easy, and frankly you’re better off avoiding signal handlers in general. Where possible, handle signals via a Dispatch event source. Reading Memory A signal handler must be very careful about the memory it touches, because the contents of that memory might have been corrupted by the crash that triggered the signal. My general rule here is that the signal handler can safely access: Its code Its stack (subject to the constraints discussed earlier) Its arguments Immutable global state In the last point, I’m using immutable to mean immutable after startup. It’s reasonable to set up some global state when the process starts, before installing your signal handler, and then rely on it in your signal handler. Changing any global state after the signal handler is installed is dangerous, and if you need to do that you must be careful to ensure that your signal handler sees consistent state, even though a crash might occur halfway through your change. You can’t protect this global state with a mutex because mutexes are not async signal safe (and even if they were you’d deadlock if the mutex was held by the thread that crashed). You should be able to use atomic operations for this, but atomic operations are notoriously hard to use correctly (if I had a dollar for every time I’ve pointed out to a developer they’re using atomic operations incorrectly, I’d be very badly paid (-: but that’s still a lot of developers!). If your signal handler reads other memory, it must take care to avoid crashing while doing that read. There’s no BSD-level API for this [1], so I recommend that you use vm_read. [1] The traditional UNIX approach for doing this is to install a signal handler to catch any memory access exceptions triggered by the read, but now we’re talking signal handling within a signal handler and that’s just silly. Writing Files If your want to write a crash report from your signal handler, you must use low-level UNIX APIs (open, write, close) because only those low-level APIs are documented to be async signal safe. You must also set up the path in advance because the standard APIs for determining where to write the file (NSFileManager, for example) are not async signal safe. Offline Symbolication Do not attempt to do symbolication from your signal handler. Rather, write enough information to your crash report to support offline symbolication. Specifically: The addresses to symbolicate For each Mach-O image in the process: The image’s path The image’s build UUID [1] The image’s load address You can get most of the Mach-O image information using the APIs in <mach-o/dyld.h> [2]. Be aware, however, that these APIs are not async signal safe. You’ll need to get this information in advance and cache it for your signal handler to record. This is complicated by the fact that the list of Mach-O images can change as you process loads and unloads code. This requires you to share mutable state with your signal handler, which is exactly what I recommend against in Reading Memory. Note You can learn about images loading and unloading using _dyld_register_func_for_add_image and _dyld_register_func_for_remove_image respectively. [1] If you’re unfamiliar with that term, see TN3178 Checking for and resolving build UUID problems and the documents it links to. [2] I believe you’ll need to parse the Mach-O load commands to get the build UUID. What to Include When deciding what to include in a crash report, there’s a three-way balance to be struck: The more information you include, the easier it is to diagnose problems. Some information is hard to obtain, either because there’s no public API to get that information, or because the API is not available to your crash reporter. Some information is so privacy-sensitive that it has no place in a crash report. Apple’s crash reporter strikes its own balance here, and I recommend that you try to include everything that it includes, subject to the limitations described in the second point. Here’s what I’d considered to be a minimal list: Information about the machine exception that triggered the crash For memory access exceptions, the address of the access that triggered the crash Backtraces of all the threads (sometimes the backtrace of a non-crashing thread can yield critical information about the crash) The crashed thread Its thread state A list of Mach-O images, as discussed in the Offline Symbolication section IMPORTANT Make sure you report the thread backtraces in a consistent order. Without that it’s hard to correlate information across crash reports. Revision History 2026-06-30 Updated the note about the CrashReportExtension framework with some critical info about the supported platforms. 2026-06-09 Added a quick note about CrashReportExtension framework to the preamble. 2025-08-25 Added some links to examples of third-party crash reports not preserving the Apple crash report. Added a link to TN3178. Made other minor editorial changes. 2022-05-16 Fixed a broken link. 2021-09-10 Expanded the General Advice section to include pointers to Apple crash report resources, including MetricKit. Split the second half of that section out in to a new Why Is This Impossible? section. Made minor editoral changes. 2021-02-27 Fixed the formatting. Made minor editoral changes. 2019-05-13 Added a reference to my Async Signal Safe Functions vs Dyld Lazy Binding post. 2019-02-15 Expanded the introduction to the Preserve the Apple Crash Report section. 2019-02-14 Clarified the complexities of an out-of-process crash reporter. Added the What to Include section. Enhanced the Signals section to cover reentrancy and stack overflow. Made minor editoral changes. 2019-02-13 Made minor editoral changes. Added a new footnote to the Signals section. 2019-02-12 First posted.
0
0
20k
2w
Xcode Bug Installed Platforms
Hello, I’m using the latest version of Xcode, 26.6. I’m unable to permanently delete old installed iOS platform versions. I remove them from Xcode settings, and the deletion appears to complete successfully, but after rebooting my Mac they appear again, as if nothing had changed. Do you have any suggestions for how to remove them correctly and permanently?
3
0
114
2w
Xcode 27 How do we declare the accent color?
Hi guys In Xcode 27, we have to create the Assets Catalog file ourselves. This file is empty. The icon now is generated by Icon Composer, but how do you specify the accent color? I tried creating a Color set with the name AccentColor but didn't work. And look for options in the project settings but couldn't find any.
Replies
1
Boosts
0
Views
111
Activity
1w
ibtool omits "Estimate Size: Automatic" from compiled nibs when deployment target is iOS 17+
I found that Xcode 26.1.1 (17B100) silently disables UICollectionView self-sizing configured in Interface Builder, depending on the minimum deployment target. I've fixed this issue in my project by explicitly setting the estimatedItemSize to UICollectionViewFlowLayout.automaticSize, but I was wondering whether this is intended behavior, or am I missing something? When a XIB contains a UICollectionViewFlowLayout with Estimate Size: Automatic (automaticEstimatedItemSize="YES" in the document source): <collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" automaticEstimatedItemSize="YES" minimumLineSpacing="6" minimumInteritemSpacing="6"> <size key="itemSize" width="128" height="32"/> </collectionViewFlowLayout> ibtool drops the estimated-size key from the compiled nib if IPHONEOS_DEPLOYMENT_TARGET is 17.0 or later. It can be confirmed by compiling the same XIB at two deployment targets: $ ibtool --target-device iphone --minimum-deployment-target 16.0 --compile out16.nib View.xib $ strings out16.nib | grep -i estimat estimatedItemSize # present $ ibtool --target-device iphone --minimum-deployment-target 17.0 --compile out17.nib View.xib $ strings out17.nib | grep -i estimat # (nothing - key is gone) At runtime the flow layout decodes estimatedItemSize = .zero, so self-sizing is silently disabled and every cell is laid out at the placeholder Cell Size (128x32 above), regardless of its content: decoded estimatedItemSize = (0.0, 0.0), itemSize = (128.0, 32.0) // target 17.0 decoded estimatedItemSize = (1.79e+308, 1.79e+308) // target 16.0, works This is independent of the runtime OS version — I reproduced it on iOS 18.4 and iOS 26.1 simulators. The information is simply missing from the compiled nib, and no build warning or error is emitted. Confusingly, UIKit still calls the cell's preferredLayoutAttributesFitting(_:), so cells appear to compute correct sizes; they are just never adopted by the layout, which makes this quite hard to debug. Workaround — set it in code after the nib loads (the XIB cannot be fixed at the source level because the attribute is dropped at compile time): (collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.estimatedItemSize = UICollectionViewFlowLayout.automaticSize I attached minimal reproduction project (toggle IPHONEOS_DEPLOYMENT_TARGET between 16.0 and 17.0 to see both behaviors) to the feedback filed as FB23526517
Replies
0
Boosts
0
Views
58
Activity
2w
QR code scan deeplink not work in XCode test run?
Hi, I'm trying to figure out what is true here - if I am not in the correct forum please direct me :-) A. It is not possible to test a QR code scan that contains a deeplink into my iOS app from an XCoode build test run. In other words, The build must be published to Test Flight for the iOS's QR code scan sub-system to be able to process the deeplink into my app? If I am wrong about this, it sure would help with testing to be able to test directly from the local XCode build test. If so, can someone point me in the direction of what I would need to do for that? Thanks for your input either way!
Replies
1
Boosts
0
Views
290
Activity
2w
Xcode 27 beta deployment issue
Im unable to deploy Xcode 27 beta code to an iPhone 17 pro The build is successful but its not loading
Replies
2
Boosts
0
Views
290
Activity
2w
Xcode 27 release notes mention that the minimum deployment target is macOS 11.0, but Xcode itself says that only macOS 12.0 to 27.0 are supported
The release notes at https://developer.apple.com/documentation/xcode-release-notes/xcode-27-release-notes mention that the minimum deployment target is macOS 11.0, but Xcode itself says that only macOS 12.0 to 27.0 are supported. Which one is correct, Xcode or the release notes? I created FB23514411.
Replies
0
Boosts
0
Views
106
Activity
2w
无法下载 Metal toolchain
我用Xcode自动下载无法下载Metal工具 我重启了我的Mac 使用命令行工具安装仍然失败 尝试使用了日本VPN结果一样但是准备阶段时间变长了
Replies
0
Boosts
0
Views
53
Activity
2w
Xcode 26, how to uncheck "Connect via network" for physical device?
This forced network connection severely affects the development efficiency. No matter how you implement communication, when you plug in a USB device, you must and definitely prioritize using USB. If you always use the network or rely on the mobile network card, it will interfere with the efficiency of the policy for connecting via the mobile network. When there are many people in our company sharing a Wi-Fi network and it is already very slow, it is impossible to debug this, which is extremely annoying. Why do you have to prohibit developers from setting whether to debug through USB or the network? You can't figure it out because your network is fast. When your network is congested, it is completely unusable. Why not let them choose for themselves? I don't understand why you have to hide this switch. It is very stupid.
Replies
0
Boosts
0
Views
52
Activity
2w
DriverKit target in iPad app, missing libclang_rt.profile_driverkit.a
I'm trying to build the DriverKit template driver target in an Xcode project which contains an app targeting iPadOS 17. I've made no modifications to the DriverKit template. When building, I get this link error ld: file cannot be open()ed, errno=2 path=/Applications/Xcode 15.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.profile_driverkit.a in '/Applications/Xcode 15.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.profile_driverkit.a' anyone know how to fix this? My search turned up something about building llvm from sources, which seems like overkill to put a DriverKit driver into an iPad app.
Replies
5
Boosts
2
Views
2.1k
Activity
2w
Xcode 27 How to specify the bundle Identifier
Xcode 27 creates a placeholder for the bundle identifier of a new project. devplaceholder.$(PROJECT_UNIQUE_VALUE:identifier).$(PRODUCT_NAME:identifier) I have two questions. Is it enough to change the bundle id from the Signing & Capabilities panel or do we need to change it somewhere else? What are Apple recommendations? Should we only replace the devplaceholder value and keep the unique value and product name, provide our won id but keep the product name, or replace everything with our own bundle ID? Thanks
Replies
2
Boosts
0
Views
181
Activity
2w
Xcode RAM Usage Problem
👋🏻 Hello Apple Developer Community, I’ve recently got the problem with the current Xcode Beta Version and the Preview Feature. Because when I try to load the Preview, the RAM Usage spikes and it’s nearly at the limit on my MacBook (16GB RAM). (Note: This is happening while loading up the Preview) But when I haven’t loaded the Preview Window, the overall RAM Usage of my system is ver low (Note: This is when Xcode has is not loading the Preview) (Note: This is after quitting Xcode for cancelling the load of the Preview) All Pictures are in German, sorry for that ☹️. What are possible problems or solutions against this problem? Have a nice day / evening 😁
Replies
1
Boosts
0
Views
162
Activity
2w
Shortcuts and App Intents does not work on simulators running iOS 26 or iOS 27
Hello, Shortcuts and App Intents don't work on simulators running iOS 26 or iOS 27. It's working fine on simulators running iOS 18. It makes testing and adopting new technologies difficult. Please check this feedback which contains a video showcasing the issue with a sample code provided by Apple: FB23342158 Regards, Axel
Replies
3
Boosts
2
Views
184
Activity
2w
Unable to run App Shortcut: App Shortcuts cannot run on iOS Simulator 26.5 through 27.0 beta 2
App Shortcuts cannot be debugged or executed on iOS Simulator runtimes from iOS 26.5 through iOS 27.0 beta 2 when using Xcode 26.5 through Xcode 27 beta 2. When attempting to run an App Shortcut in the Shortcuts app on the simulator, Shortcuts shows the error: Unable to run App Shortcut The simulator console logs the following error: Attempted to fetch Auto Shortcuts, but couldn't find the AppShortcutsProvider This happens even with Apple’s official App Intents sample project, so it does not appear to be specific to a third-party app implementation. Steps to Reproduce Download Apple’s official sample project from: https://developer.apple.com/documentation/appintents/acceleratingappinteractionswithappintents Open the sample project in Xcode 26.5 through Xcode 27 beta 2. Build and run the app on an iOS Simulator using iOS 26.5 through iOS 27.0 beta 2. Open the Shortcuts app in the simulator. Find one of the sample app’s App Shortcuts. Try to run the App Shortcut. Expected Result The App Shortcut should run successfully in the iOS Simulator, allowing App Shortcuts and App Intents to be debugged during development. Actual Result The Shortcuts app displays: Unable to run App Shortcut The simulator console logs: Attempted to fetch Auto Shortcuts, but couldn't find the AppShortcutsProvider The App Shortcut cannot be executed or debugged in the simulator. Reproducibility Reproduces consistently. Tested Configurations Xcode 26.5 with iOS Simulator 26.5 Xcode 27 beta 2 with iOS Simulator 27.0 beta 2
Replies
1
Boosts
0
Views
86
Activity
2w
Paired Apple Watch never appears in Xcode Devices & Simulators, Developer Mode toggle missing on watchOS
I'm blocked trying to run/debug an app on a physical Apple Watch. The iPhone connects to Xcode perfectly over USB and is fully trusted, but the paired Watch never shows up in Xcode, and because of that the Developer Mode toggle never appears on the watch itself. Environment Mac: MacOS 26.4 Xcode: 26.5 iPhone: iPhone 17, iOS 26.4 — connected to Mac via USB, trusted Apple Watch: Ultra 3, watchOS 26.3 Developer Mode: enabled on iPhone Watch is paired and working normally in the iPhone Watch app What happens In Xcode → Window → Devices and Simulators, only the iPhone ("Brian") shows under Connected, with its installed apps listed correctly. The paired Apple Watch does not appear under it or as a separate entry. On the watch, Settings → Privacy & Security has no Developer Mode item. I understand this only surfaces after Xcode successfully connects to the watch, so I believe the missing Xcode connection is the root cause. When I first connected the iPhone via cable, a Trust prompt did appear on the watch and I accepted it. What I've already tried Enabled Developer Mode on iPhone (toggled off/on, with restarts) Connected iPhone via USB and confirmed Trust on both iPhone and watch Restarted Mac, iPhone, and watch multiple times Confirmed Bluetooth and Wi-Fi are on across all three devices Kept the watch unlocked and on my wrist, close to the iPhone and Mac Despite this, the watch never appears in Xcode and the Developer Mode toggle never surfaces on watchOS. Questions Is this the known Xcode 26 / watchOS 26 tunneling/discovery regression, or is something else going on in my setup? Is there an Apple-supported way to force Xcode to re-discover a paired watch without unpairing it from the iPhone? Has any specific combination of macOS / Xcode / watchOS versions reliably resolved this for anyone? Any guidance appreciated. Happy to file a Feedback Assistant report and share the ID if useful.
Replies
1
Boosts
0
Views
116
Activity
2w
Could not find library with name ”/usr/lib/swift/libswiftWebKit.dylib“
Canvas Previews (targeting macOS) in both Xcode 16.4 & Xcode 26 fail to load, when the project imports a Swift package that imports and uses WebKit. I'm on macOS 15.5. Tried also to bring minimum targets of both the project and the package to 15.0. I see that there are some work-arounds for iOS simulator but nothing for the Mac. Anyone facing the same problem?
Replies
6
Boosts
0
Views
404
Activity
2w
Xcode 27: Bugs / Feedbacks
Hi, I have listed below the Feedbacks for Xcode 27, please have a look at it, considerable time was spent on filing these feedbacks, thanks! Environments All of them were tested on the environment: macOS 26.5.1 (25F80) Xcode 27.0 beta (27A5194q) Feedbacks FB23133706 (Git stage tab) FB23132869 (markdown - code block) FB23132403 (markdown - search) FB23078039 (stash - slow / unresponsive) FB23077930 (stash - allow multiselection) FB23055381 (Run destination - Clear recents) FB23041713 (SwiftUI preview - SwiftData) FB23033844 (Bundle ID) FB23033231 (Device Hub - sizes)
Replies
10
Boosts
1
Views
659
Activity
2w
Unable to sign into sandbox account on simulator / device hub
Hi, I am unable to sign into the sandbox account on the simulator. Settings > Developer > Sandbox Apple Account > Sign in Xcode: 26.6 (17F113) Xcode Simulator: 16.0 (1063.4) I have even tried on Device Hub on Xcode 27. I vaguely remember being able to sign into the simulator using Questions: Is anyone able to sign into Sandbox account on the simulator / device hub? Is there any workaround? Is this a known issue?
Replies
0
Boosts
0
Views
102
Activity
2w
Implementing Your Own Crash Reporter
I often get questions about third-party crash reporting. These usually show up in one of two contexts: Folks are trying to implement their own crash reporter. Folks have implemented their own crash reporter and are trying to debug a problem based on the report it generated. This is a complex issue and this post is my attempt to untangle some of that complexity. IMPORTANT iOS 27, currently in beta, introduced support for out-of-process crash reporting using the CrashReportExtension framework. I haven’t yet had time to update this post to cover that technology. However, if you’re planning to implement your own crash reporter on iOS, you should start there. (The documentation currently states that this feature is available on macOS 27, also currently in beta, but that’s not true (r. 180425854) and I’ve no info to share as to when that’ll change.) If you have a follow-up question about anything I've raised here, please put it in a new thread with the Debugging tag. IMPORTANT All of the following is my own direct experience. None of it should be considered official DTS policy. If you have a specific question that needs a direct answer — perhaps you’re trying to convince your boss that implementing your own crash reporter is a very bad idea — start a dedicated thread here on the forums and we can discuss the details there. Use whatever subtopic is appropriate for your issue, but make sure to add the Debugging tag so that I see it go by. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" Scope First, I can only speak to the technical side of this issue. There are other aspects that are beyond my remit: I don’t work for App Review, and only they can give definitive answers about what will or won’t be allowed on the store. Implementing your own crash reporter has significant privacy implications. IMPORTANT If you implement your own crash reporter, discuss the privacy impact with a lawyer. This post assumes that you are implementing your own crash reporter. A lot of folks use a crash reporter from another third party. From my perspective these are the same thing. If you use a custom crash reporter, you are responsible for its behaviour, both good and bad, regardless of where the actual code came from. Note If you use a crash reporter from another third party, run the tests outlined in Preserve the Apple Crash Report to verify that it’s working well. General Advice I strongly advise against implementing your own crash reporter. It’s very easy to create a basic crash reporter that works well enough to debug simple problems. It’s impossible to implement a good crash reporter, one that’s reliable, binary compatible, and sufficient to debug complex problems. The bulk of this post is a low-level explanation of that impossibility. Rather than attempting the impossible, I recommend that you lean in to Apple’s crash reporter. In recent years it’s acquired some really cool new features: If you’re creating an App Store app, the Xcode organiser gives you easy, interactive access to Apple crash reports. If you’re an enterprise developer, consider switching to Custom App Distribution. This yields all the benefits of App Store distribution without your app being generally available on the store. iOS 14 and macOS 12 report crashes in MetricKit. This is a very cool feature, and I’m surprised by how few people use it effectively. If you previously dismissed Apple crash reports as insufficient, I encourage you to reconsider that decision. Why Is This Impossible? Earlier I said “It’s impossible to implement a good crash reporter”, and I want to explain why I’m confident enough in my conclusions to use that specific word. There are two fundamental problems here: On iOS (and the other iOS-based platforms, watchOS and tvOS) your crash reporter must run inside the crashed process. That means it can never be 100% reliable. If the process is crashing then, by definition, it’s in an undefined state. Attempting to do real work in that state is just asking for problems [1]. To get good results your crash reporter must be intimately tied to system implementation details. These can change from release to release, which invalidates the assumptions made by your crash reporter. This isn’t a problem for the Apple crash reporter because it ships with the system. However, a crash reporter that’s built in to your product is always going to be brittle. I’m speaking from hard-won experience here. I worked for DTS during the PowerPC-to-Intel transition, and saw a lot of folks with custom crash reporters struggle through that process. Still, this post exists because lots of folks ignore this reality, so the subsequent sections contain advice about specific technical issues. WARNING Do not interpret any of the following as encouragement to implement your own crash reporter. I strongly advise against that. However, if you ignore my advice then you should at least try to minimise the risk, which is what the rest of this document is about. [1] On macOS it’s possible for your crash reporter to run out of process, just like the Apple crash reporter. However, possible is not the same as easy. In fact, running out of process can make things worse: It prevents you from geting critical state for the crashed process without being tightly bound to OS implementation details. It would be nice if Apple provided APIs for this sort of thing, but that’s currently not the case. Preserve the Apple Crash Report You must ensure that your crash reporter doesn’t disrupt the Apple crash reporter. This is important for three reasons: Some fraction of your crashes will not be caused by your code but by problems in framework code, and accurate Apple crash reports are critical in diagnosing such issues. When dealing with really hard-to-debug problems, you need the more obscure info that’s shown in the Apple crash report. If you’re working with someone from Apple (here on the forums, via a bug report, or a DTS case, or whatever), they’re going to want an accurate Apple crash report. If your crash reporter is disrupting the Apple crash reporter — either preventing it from generating crash reports entirely [1], or distorting those crash reports — that limits how much they can help you. IMPORTANT This is not a theoretical concern. The forums have many threads where I’ve been unable to help folks debug a gnarly problem because their third-party crash reporter didn’t preserve the Apple crash report (see here, here, and here for some examples). To avoid these issues I recommend that you test your crash reporter’s impact on the Apple crash reporter. The basic idea is: Create a program that generates a set of specific crashes. Run through each crash. Verify that your crash reporter produces sensible results. Verify that the Apple crash reporter produces the same results as it does without your crash reporter With regards step 1, your test suite should include: An un-handled language exception thrown by your code An un-handled language exception thrown by the OS (accessing an NSArray out of bounds is an easy way to get this) Various machine exceptions (at a minimum, memory access, illegal instruction, and breakpoint exceptions) Stack overflow Make sure to test all of these cases on both the main thread and a secondary thread. With regards step 4, check that the resulting Apple crash report includes correct values for: The exception info The crashed thread That thread’s state Any application-specific info, and especially the last exception backtrace [1] A particularly pathological behaviour here is to end your crash reporter by calling exit. This completely suppresses the Apple crash report. Some third-party language runtimes ‘helpfully’ include such a crash reporter, which makes it very hard to debug problems that occur within your process but outside of that language. Signals Many third-party crash reporters use UNIX signals to catch the crash. This is a shame because using Mach exception handling, the mechanism used by the Apple crash reporter, is generally a better option. However, there are two reasons to favour UNIX signals over Mach exception handling: On iOS-based platforms your crash reporter must run in-process, and doing in-process Mach exception handling is not feasible. Folks are a lot more familiar with UNIX signals. Mach exception handling, and Mach messaging in general, is pretty darned obscure. If you use UNIX signals for your crash reporter, be aware that this API has some gaping pitfalls. First and foremost, your signal handler can only use async signal safe functions [1]. You can find a list of these functions in sigaction man page [2] [3]. WARNING This list does not include malloc. This means that a crash reporter’s signal handler cannot use Objective-C or Swift, as there’s no way to constrain how those language runtimes allocate memory [4]. That means you’re stuck with C or C++, but even there you have to be careful to comply with this constraint. The Operative: It’s worse than you know. Captain Malcolm Reynolds: It usually is. Many crash reports use functions like backtrace (see its man page) to get a backtrace from their signal handler. There’s two problems with this: backtrace is not an async signal safe function. backtrace uses a naïve algorithm that doesn’t deal well with cross signal handler stack frames [5]. The latter point is particularly worrying, because it hides the identity of the stack frame that triggered the signal. If you’re going to backtrace out of a signal, you must use the crashed thread’s state (accessible via the handlers uap parameter) to start your backtrace. Apropos that, if your crash reporter wants to log the state of the crashed thread, that’s the place to get it. Your signal handler must be prepared to be called by multiple threads. A typical crashing signal (like SIGSEGV) is delivered to the thread that triggered the machine exception. While your signal handler is running on that thread, other threads in your process continue to run. One of these threads could crash, causing it to call your signal handler. It’s a good idea to suspend all threads in your process early in your signal handler. However, there’s no way to completely eliminate this window. Note The need to suspend all the other threads in your process is further evidence that sticking to async signal safe functions is required. An unsafe function might depend on a thread you’ve suspended. A typical crashing signal is delivered on the thread that triggered the machine exception. If the machine exception was caused by a stack overflow, the system won’t have enough stack space to call your signal handler. You can tell the system to switch to an alternative stack (see the discussion of SA_ONSTACK in the sigaction man page) but that isn’t a complete solution (because of the thread issue discussed immediately above). Finally, there’s the question of how to exit from your signal handler. You must not call exit. There’s two problems with doing that: exit is not async signal safe. In fact, exit can run arbitrary code via handlers registered with atexit. If you want to exit the process, call _exit. Exiting the process is a bad idea anyway, because it will prevent the Apple crash reporter from running. This is very poor form. For an explanation as to why, see Preserve the Apple Crash Report (above). A better solution is to unregister your signal handler (set it to SIG_DFL) and then return. This will cause the crashed process to continue execution, crash again, and generate a crash report via the Apple crash reporter. [1] While the common signals caught by a crash reporter are not technically async signals (except SIGABRT), you still have to treat them as async signals because they can occur on any thread at any time. [2] It’s reasonable to extend this list to other routines that are implemented as thin shims on a system call. For example, I have no qualms about calling vm_read (see below) from a signal handler. [3] Be aware, however, that even this list has caveats. See my Async Signal Safe Functions vs Dyld Lazy Binding post for details. [4] I expect that it’ll eventually be possible to write signal handlers in Swift, possibly using some facility that evolves from the the existing, but unsupported, @_noAllocation and @_noLocks attributes. If you’d like to get involved with that effort, I recommend that engage with the Swift Evolution process. [5] Cross signal handler stack frames are pushed on to the stack by the kernel when it runs a signal handler on a thread. As there’s no API to learn about the structure of these frames, there’s no way to backtrace across one of these frames in isolation. I’m happy to go into details but it’s really not relevant to this discussion [6]. If you’re interested, start a new thread with the Debugging tag and we can chat there. [6] (Arg, my footnotes have footnotes!) The exception to this is where your trying to generate a crash report for code running in a signal handler. That’s not easy, and frankly you’re better off avoiding signal handlers in general. Where possible, handle signals via a Dispatch event source. Reading Memory A signal handler must be very careful about the memory it touches, because the contents of that memory might have been corrupted by the crash that triggered the signal. My general rule here is that the signal handler can safely access: Its code Its stack (subject to the constraints discussed earlier) Its arguments Immutable global state In the last point, I’m using immutable to mean immutable after startup. It’s reasonable to set up some global state when the process starts, before installing your signal handler, and then rely on it in your signal handler. Changing any global state after the signal handler is installed is dangerous, and if you need to do that you must be careful to ensure that your signal handler sees consistent state, even though a crash might occur halfway through your change. You can’t protect this global state with a mutex because mutexes are not async signal safe (and even if they were you’d deadlock if the mutex was held by the thread that crashed). You should be able to use atomic operations for this, but atomic operations are notoriously hard to use correctly (if I had a dollar for every time I’ve pointed out to a developer they’re using atomic operations incorrectly, I’d be very badly paid (-: but that’s still a lot of developers!). If your signal handler reads other memory, it must take care to avoid crashing while doing that read. There’s no BSD-level API for this [1], so I recommend that you use vm_read. [1] The traditional UNIX approach for doing this is to install a signal handler to catch any memory access exceptions triggered by the read, but now we’re talking signal handling within a signal handler and that’s just silly. Writing Files If your want to write a crash report from your signal handler, you must use low-level UNIX APIs (open, write, close) because only those low-level APIs are documented to be async signal safe. You must also set up the path in advance because the standard APIs for determining where to write the file (NSFileManager, for example) are not async signal safe. Offline Symbolication Do not attempt to do symbolication from your signal handler. Rather, write enough information to your crash report to support offline symbolication. Specifically: The addresses to symbolicate For each Mach-O image in the process: The image’s path The image’s build UUID [1] The image’s load address You can get most of the Mach-O image information using the APIs in <mach-o/dyld.h> [2]. Be aware, however, that these APIs are not async signal safe. You’ll need to get this information in advance and cache it for your signal handler to record. This is complicated by the fact that the list of Mach-O images can change as you process loads and unloads code. This requires you to share mutable state with your signal handler, which is exactly what I recommend against in Reading Memory. Note You can learn about images loading and unloading using _dyld_register_func_for_add_image and _dyld_register_func_for_remove_image respectively. [1] If you’re unfamiliar with that term, see TN3178 Checking for and resolving build UUID problems and the documents it links to. [2] I believe you’ll need to parse the Mach-O load commands to get the build UUID. What to Include When deciding what to include in a crash report, there’s a three-way balance to be struck: The more information you include, the easier it is to diagnose problems. Some information is hard to obtain, either because there’s no public API to get that information, or because the API is not available to your crash reporter. Some information is so privacy-sensitive that it has no place in a crash report. Apple’s crash reporter strikes its own balance here, and I recommend that you try to include everything that it includes, subject to the limitations described in the second point. Here’s what I’d considered to be a minimal list: Information about the machine exception that triggered the crash For memory access exceptions, the address of the access that triggered the crash Backtraces of all the threads (sometimes the backtrace of a non-crashing thread can yield critical information about the crash) The crashed thread Its thread state A list of Mach-O images, as discussed in the Offline Symbolication section IMPORTANT Make sure you report the thread backtraces in a consistent order. Without that it’s hard to correlate information across crash reports. Revision History 2026-06-30 Updated the note about the CrashReportExtension framework with some critical info about the supported platforms. 2026-06-09 Added a quick note about CrashReportExtension framework to the preamble. 2025-08-25 Added some links to examples of third-party crash reports not preserving the Apple crash report. Added a link to TN3178. Made other minor editorial changes. 2022-05-16 Fixed a broken link. 2021-09-10 Expanded the General Advice section to include pointers to Apple crash report resources, including MetricKit. Split the second half of that section out in to a new Why Is This Impossible? section. Made minor editoral changes. 2021-02-27 Fixed the formatting. Made minor editoral changes. 2019-05-13 Added a reference to my Async Signal Safe Functions vs Dyld Lazy Binding post. 2019-02-15 Expanded the introduction to the Preserve the Apple Crash Report section. 2019-02-14 Clarified the complexities of an out-of-process crash reporter. Added the What to Include section. Enhanced the Signals section to cover reentrancy and stack overflow. Made minor editoral changes. 2019-02-13 Made minor editoral changes. Added a new footnote to the Signals section. 2019-02-12 First posted.
Replies
0
Boosts
0
Views
20k
Activity
2w
How to simulate two-finger touches in the Device Hub?
My app relies on two-finger tap for some interactions. This was easy in the old simulator by holding down option while clicking. Is there an equivalent interaction in Device Hub? (Option-click no longer seems to work.) If not, will this be added back in a future beta?
Replies
2
Boosts
1
Views
132
Activity
2w
Problems using Anthropic Agent in Xcode 27 beta 2
I signed in to Xcode using my Anthropic credentials. When I attempt to start a new conversation the text box is not enabled and I see a message related to Codex..
Replies
1
Boosts
0
Views
91
Activity
2w
Xcode Bug Installed Platforms
Hello, I’m using the latest version of Xcode, 26.6. I’m unable to permanently delete old installed iOS platform versions. I remove them from Xcode settings, and the deletion appears to complete successfully, but after rebooting my Mac they appear again, as if nothing had changed. Do you have any suggestions for how to remove them correctly and permanently?
Replies
3
Boosts
0
Views
114
Activity
2w