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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

Localizing NSAlarmKitUsageDescription
I've added NSAlarmKitUsageDescription to Info.plist and InfoPlist.xcstrings. The localized string is being used when I run the app, but Xcode is marking the string as "stale" in InfoPlist.xcstrings. This doesn't occur for any of the other UsageDescription strings in our app, such as NSPhotoLibraryUsageDescription and NSSiriUsageDescription. This occurs in both Xcode 26.2 and Xcode 26.3 RC. Is this a known issue? Should I just mark the string as being managed "Manually" instead of "Automatically" to make the warning go away?
1
0
33
4d
protocol witness error in Playgrounds
I'm importing SwiftUI, Foundation and Charts into an iOS app I'm writing in Swift in Xcode Playgrounds and am getting this error: error: Couldn't look up symbols: protocol witness table for Foundation.Date : Charts.Plottable in Charts the code looks like this in just two example files: file 1, the view import Foundation import SwiftUI import Charts import PlaygroundSupport struct FirstChart_WithDates: View { private let data = ChartDateAndDoubleModel.mockData(months: 3) var body: some View { Chart(data) { item in BarMark( x: .value("Label", item.date, unit: .month), y: .value("Value", item.value) ) } .padding() .aspectRatio(1, contentMode: .fit) .dynamicTypeSize(.accessibility1) ChartDateAndDoubleModelView(data: data) } } struct ChartDateAndDoubleModelView: View { var data: [ChartDateAndDoubleModel] var body: some View { VStack { HeaderRowView(texts: ["date", "value"]) ForEach(data) { datum in HStack { Text(datum.date.formatted(date: .abbreviated, time: .omitted)) .frame(maxWidth: .infinity) // TODO: Format for 2 decimal places. Text(datum.value, format: .number.precision(.fractionLength(2))) .frame(maxWidth: .infinity) } } } .padding(.bottom, 8) .overlay(.quaternary, in: .rect(cornerRadius: 8).stroke()) .padding() } } struct HeaderRowView: View { var texts: [String] var body: some View { HStack(spacing: 2.0) { ForEach(texts, id: \.self) { text in Text(text) .padding(4) .frame(maxWidth: .infinity) .background(.quaternary) } } .font(.headline) .mask(UnevenRoundedRectangle(topLeadingRadius: 8, topTrailingRadius: 8)) } } and file 2, the model: import Foundation import SwiftUI import Charts // ChartDateAndDoubleModel.swift // // // Created by Michael Isbell on 2/10/26. // public struct ChartDateAndDoubleModel: Identifiable { public let id = UUID() public let date: Date public let value: Double } public extension ChartDateAndDoubleModel { static func mockData(months: Int = 5) -> [ChartDateAndDoubleModel] { var data: [ChartDateAndDoubleModel] = [] let calendar = Calendar(identifier: .gregorian) let currentDate = Date() for month in 0..<months { //add month to current date and append to data data.append( ChartDateAndDoubleModel( date: calendar.date(byAdding: .month, value: month, to: currentDate)!, value: Double.random(in: 0...1000) ) ) } return data } }
1
0
35
4d
XCTFail immediately aborts the test in Xcode 26 — no retry on failure
Hi, I’m seeing an unexpected change in how XCTFail behaves in UI tests after updating Xcode. I use the following helper method: `func waitForExistance(file: StaticString, line: UInt) -> Self { if !(element.exists || element.waitForExistence(timeout: Configuration.current.predicateTimeout)) { XCTFail("couldn't find element: \(element) after \(Configuration.current.predicateTimeout) seconds", file: file, line: line) return self } else { return self } }` In Xcode 16.4, this worked as expected: – when an element wasn’t found, XCTFail was triggered, but the test continued running, allowing my retry logic to execute. After updating to Xcode 26.1 / 26.2 - the test now immediately aborts after XCTFail, without executing the next retry. The logs show: `t = 113.22s Tear Down t = 113.22s Terminate com.viessmann.care:81789 *** Assertion failure in -[UITests.Tests _caughtUnhandledDeveloperExceptionPermittingControlFlowInterruptions:caughtInterruptionException:whileExecutingBlock:], XCTestCase+IssueHandling.m:273 Test Case '-[UITests.Tests test_case]' failed (114.323 seconds). Flushing outgoing messages to the IDE with timeout 600.00s Received confirmation that IDE processed remaining outgoing messages` It looks like XCTFail in Xcode 26 is now treated as an unhandled developer exception, which stops the test execution immediately, even when it’s called inside a helper method. This was not the case in earlier versions. My questions: Is this a regression in XCTest? Or an intentional change in how XCTFail behaves in newer Xcode versions? Should failures now be reported differently (e.g., using record(.init(type: .assertionFailure, …))) if I want to continue the test instead of aborting it? I would like to restore the previous behavior where the failure is logged without terminating the entire test, so my retry mechanism can still run. Has anyone else run into this after upgrading? Thanks in advance! If you’d like, I can also add recommended workarounds that actually work with Xcode 16.4 (e.g., replacing XCTFail with a non-terminating issue record).
4
3
464
5d
String Catalog Symbols: No Reference-Language Fallback for Partially Translated Locales
I'm having troubles converting my string catalog to symbols because for partly translated languages there is no fallback to the reference language. Let me give you an example. Example Assume an app that supports two languages: English and Japanese. The app is very simple and has only two strings, using symbols in a String Catalog: Key: .helloWorld → “Hello World!” Key: .info → “Information” Case 1: No Japanese translations If I launch the app in Japanese and neither string is translated, English is used as a fallback. The UI shows: “Hello World!” “Information” This is exactly what I would expect. Case 2: Only one string translated Now assume I translate only one string into Japanese: .helloWorld → “こんにちは世界” When I launch the app in Japanese now: .helloWorld correctly shows “こんにちは世界” .info shows info, not “Information” So instead of falling back to English, the key is displayed. This issue does not pop up when I don't use symbols. Because then, my SwiftUI Text elements contain the English ideal text as a (kind of) key. I assume for commercial apps all strings are always translated into all supported languages. But this is not the case for apps where translations happens through crowd translations. Check the following link. There you will see that only English (reference language) and German (my native language) are 100% translated. Others will follow over time. https://poeditor.com/join/project/J2Qq2SUzYr For now, I guess I'll have to avoid symbols. Or is there a better way to handle this?
1
0
37
5d
(Xcode 26.0 → 26.2) Constant UI flickering in split view mode
Hello, I’ve been experiencing a persistent issue in Xcode since version 26.0, and it is still present in 26.2. When using the split view to display two files side by side, the area in the top‑right corner of the window (the inspector / options panel) starts flickering continuously. This happens regardless of whether I’m using the light or dark theme, and even with the Liquid Glass effect disabled in macOS settings. None of these changes have any impact on the issue. I have already submitted a bug report through Xcode (Feedback Assistant), but the issue is still present as of today. The flickering makes the interface difficult to use and visually very distracting. I’ve attached a video to clearly show the issue. I will review the attachment at the time I publish this post. Thanks in advance for any help or feedback. Video 1 https://www.icloud.com/iclouddrive/077l-R7Ybvxz89NI-B7DliEuA#xcode_bug1 Video 2 https://www.icloud.com/iclouddrive/0f6bJp48ioGRdkYiA2U4sI-cg#xcode-bug2
5
1
250
5d
Annoying popup window in Xcode Previews when the initial controller of the main storyboard is a macOS window
I started a project targeting macOS and used Storyboard app lifecycle. I also used Xcode Previews in this project. If I: Keep the entry point of the main storyboard to a window controller. (as default setup in macOS), Turn the Xcode window into full-screen, That window controller would pop up its window every time Xcode Previews refreshes. I tested in Xcode 26.3 RC and many versions before.
3
0
106
6d
XCUItest - Accessing page content when using deeply nested React Navigation navigators on iOS Using
Hello! I've been trying to automate tests using Appium/XCUITests in a React Native APP, but I'm finding many blockers. They are related to the amount of nested elements in the "DOM" in which the XCUItest can not go deeper to get all the elements we need. snapshotMaxDepth -> The XCUITest does not support more than 60 value, otherwise it returns the following error: Got response with status 404: {"value":{"error":"stale element reference","message":"The previously found element "Application 'xyz.xxx.xxx'" is not present in the current view anymore. Make sure the application UI has the expected state. Original error: Error kAXErrorIllegalArgument getting snapshot for element <AXUIElementRef 0x600003aaf750> {pid=95967} {uid=[ID:1 hash:0x0]}","traceback":"(\n\t0 CoreFoundation 0x00007fff20405604 __exceptionPreprocess + 242\n\t1 libobjc.A.dylib 0x00007fff201a4a45 objc_exception_throw + 48\n\t2 WebDriverAgentLib 0x000000010a3caa53 -[XCUIElement(FBUtilities) fb_takeSnapshot] + 723\n\t3 WebDriverAgentLib 0x000000010a3cad07 -[XCUIElement(FBUtilities) fb_snapshotWithAttributes:maxDepth:] + 183\n\t4 WebDriverAgentLib 0x000000010a37baea +[FBXPath writeXmlWithRootElement:indexPath:elementStore:includedAttributes:writer:] + 778\n\t5 WebDriverAgentLib 0x000000010a37b12c +[FBXPath xmlRep... But if I inform less than 60, the XCUITest is not able to get all the elements we need to automate: There are many threads about this, all of them the issue is in the XCUITest: https://github.com/appium/appium/issues/14825 https://discuss.appium.io/t/handling-staleelementreferenceexception/35095/11 https://github.com/appium/appium/issues/18085 https://discuss.appium.io/t/error-in-appium-desktop-refreshing-source-after-adding-snapshotmaxdepth-greater-than-62/34058 https://stackoverflow.com/questions/74235441/appium-cant-reach-elements-in-ios-source-tree-they-are-too-deep-works-fine-in Tested all possible solutions suggested in the threads, but I will have the issue.
15
12
4.5k
6d
XCode does not recognize my iPhone
I'm trying to run my app on my iPhone and XCode is unable to detect it. Versions (as of time of writing, these are all the latest versions) XCode: 15.0.1 iOS: 17.1.2 macOS: Sonoma 14.1.2 What I've tried Updating all hardware to the latest versions. Restarting all hardware. Clearing cache/derived data. Using different USBC ports/cables. Using the XCode 15.1-Beta 3 (the latest beta) Clearing trusted computers and re-trusting Disabling Multipath Networking (solution for someone else on the dev forums) Creating a brand new xcode project. Disabling all wifi/bluetooth and reconnecting Using different wifi networks Calling mac support (they directed me back here) Scouring forums What happens I start by disconnecting my phone from my computer, clear trusted computers, restart xcode, and start (basically) from a completely blank slate. First I open XCode to my project. Then I connect my iPhone via USBC. I see that XCode says "iPhone not eligible while pairing in progress" (or something like that). I see on my phone that I must trust this computer, I hit trust, I enter my phone's passcode, then that disappears on my phone, and in XCode the message about eligibility disappears. I then click on the device selector to choose between either a simulator or a hardware device and under hardware I only see a message that says "No eligible devices connected to my mac". If I open the "Manage Run Destinations" organizer I see all the simulators there in the simulators tab, but when I go to the Devices tab, I see nothing. Sometimes when I go through this process, I can get a banner to appear up top, but still no device shows up on the left. The banner will show me that it is indeed my iPhone, but it will be missing information like "Serial Number" or "Capacity". Here's a screenshot of what I see. Keep in mind, this banner up top does not always show up when I go through this process. iPhone CAN be detected on my other laptop When I do this exact same thing on my other laptop, everything works just fine. Here are the specs I'm running on that laptop. (using the same cable/wifi network/etc) XCode 15.0.1 macOS: Ventura 13.6.1 iPhone 17.1.2 (I'm using the same iPhone) The only difference here being the macOS version. However, the problem started on my "broken" computer while I was running a previous major macOS version. This problem is actually what prompted my to do a system update to Sonoma. Please for the love of god, halp!!!
18
7
23k
1w
Xcode 26.3 Claude Agent can't access Desktop folder
I am using the Xcode 26.3 Claude Agent feature. Claude Agent can’t access on my Desktop folder when they are specified as chat attachments because I accidentally denied access to that folder when it was first requested. I had earlier read the Xcode 26.3 release notes, so I was somewhat aware of this known issue, but I didn't make the connection when the Desktop access prompt appeared. I wasn't expecting the permissions prompt, because the regular (non-agent) Xcode Claude is able to freely access Desktop files when they are specified as Xcode coding assistant chat session attachments. Claude Agent isn’t listed in macOS Settings > Privacy & Security > Files and Folders, so I can’t fix the permissions there. The TCC database contains these rows: % sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db \ "SELECT service, client, datetime(last_modified, 'unixepoch', 'localtime') as last_modified FROM access ORDER BY last_modified DESC" | head -2 kTCCServiceSystemPolicyDownloadsFolder|/Users/drew/Library/Developer/Xcode/CodingAssistant/Agents/Versions/26.3/claude|2026-02-07 15:19:25 kTCCServiceSystemPolicyDesktopFolder|/Users/drew/Library/Developer/Xcode/CodingAssistant/Agents/Versions/26.3/claude|2026-02-07 13:38:07 but I can’t seem to reset them using tccutil, apparently because /Users/drew/Library/Developer/Xcode/CodingAssistant/Agents/Versions/26.3/claude is not a valid bundle identifier: % tccutil reset all '/Users/drew/Library/Developer/Xcode/CodingAssistant/Agents/Versions/26.3/claude' tccutil: No such bundle identifier "/Users/drew/Library/Developer/Xcode/CodingAssistant/Agents/Versions/26.3/claude": The operation couldn’t be completed. (OSStatus error -10814.) I would like for Claude Agent to be able to access my Desktop folder. What is an appropriate next step? Thank you for any help you can provide.
1
0
72
1w
Cannot preview in Xcode
My computer setup is I work from an account with regular (non-admin) privileges. I login into the admin account to install apps, update the OS, that kind of stuff, but work is from the reduced privileges account. And, when in it, I cannot preview swiftUI views in Xcode. Incredibly frustrating, have tried everything including a complete wipeout of the disk and reinstall, but no luck. Don't have any iOS simulator targets installed, it's macOS target I am working on. If I fire up xcode from the admin account it's all good, previes work and so on. Not so in the non-admin account, consistenly getting the "Cannot preview in this file. Failed to launch xxxx" Also tried elevating the privileges of the account to Admin, rebooting, no luck. Tried creating a new account, non-admin or admin, no luck. The detailed error repeats something along the lines of: == PREVIEW UPDATE ERROR: GroupRecordingError Error encountered during update group #3 ================================== | FailedToLaunchAppError: Failed to launch GIIK.Mesh-One | | /Volumes/Glyph 2TB/Developer/M4Book/Mesh One/DerivedData/Mesh One/Build/Products/Debug/Mesh One.app | | ================================== | | | [Remote] JITError | | | | ================================== | | | | | [Remote] XOJITError | | | | | | XOJITError: Could not create code file directory for session: Permission denied Most telling is the double space between directory and for on the last error line, it sounds like a failed string interpolation because the directory name was nil or empty? This is very frustrating (I also filed FB21900410). Am I missing something obvious? I also dumped the build settings and diffed the admin and non-admin accounts and they are an exact match (save for the path names). There has to be something that's preventing the non-admin accounts from previewing, anyone know what it might be/where to look? Cheers,
0
0
134
1w
Xcode Intelligence Font Size
Dear Friends, Is there a way to increase font size of xcode intelligence window? So the text i write, and the AI response. Why do i need this? I am using 4K monitor and i dont want to make Display setting bigger and lose all screen space.
0
0
66
1w
MCP servers don’t start in Codex (Xcode 26.3)
I’m trying to use MCP servers with Xcode 26.3 Coding Intelligence (Codex agent). With a project-scoped config file at /.codex/config.toml, MCP servers are not reliably loaded. /.codex/config.toml Example: [mcp_servers.Notion] url = "https://mcp.notion.com/mcp" enabled = true [mcp_servers.XcodeBuildMCP] command = "/bin/zsh" args = ["-lc", "/opt/homebrew/bin/npx -y xcodebuildmcp@beta mcp"] enabled = true tool_timeout_sec = 10000 Expected: Xcode consistently loads MCP servers defined in /.codex/config.toml across restarts. Actual: Xcode often only exposes xcode-tools. In some sessions MCP servers appear, but after restarting Xcode they may disappear. The global file at ~/Library/Developer/Xcode/CodingAssistant/codex/config.toml also seems managed/rewritten by Xcode and isn’t reliable for custom MCP servers. Questions Is /.codex/config.toml the official/supported way to configure MCP servers for Codex in Xcode right now? Are there any requirements for Xcode to load it (e.g. workspace must be Trusted, open .xcworkspace vs .xcodeproj, full restart/force quit, etc.)? Is there any logging/diagnostics to understand why the MCP server is not starting or not being picked up?
0
2
106
1w