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 playground export is doesn't work
I am having issues with exported playgrounds from Xcode, when I try to open my exported swift fill I get the following message: "Couldn't load settings from contents.xcplayground" Xcode Version: Version 16.2 (16C5032a) Steps to reproduce Create new playground in Xcode. File->Export Open exported file. The issue still press persist after reinstalling Xcode.
0
0
189
Jan ’25
Integrating binary inside Framework via SPM
So I will summary an issue one of our clients has asked us on GitHub: https://github.com/pendo-io/pendo-mobile-sdk/issues/233 Project that is a custom framework that uses different SPM packages (one of them is Binary package), we have our main logic inside that framework and we have different targets that use this framework, everything works on the simulator, but running the app on the actual device provokes a crash saying "Binary framework was not found". We have like 20 other SPM packages that work fine, this is the first one we have an issue with. Please note I understand that SPM will not copy paste the Binary for the magic framework as it does for the apps so I suggested to embed it manually. So my question is what the best(easy) way to do it. Please refer to the following issue for more details: https://github.com/pendo-io/pendo-mobile-sdk/issues/233
0
0
78
Mar ’25
Random "<unknown>:0: warning: default will never be executed" Xcode warning
Hello! I'm experiencing a persistent SwiftCompile warning that I haven't been able to resolve for several months: <unknown>:0: warning: default will never be executed Observations: Appears randomly across different files during the build. No source location or line highlighting is provided. Persists across clean builds and project reopenings. Occurs in both Xcode Cloud and local builds. What I’ve tried: Ensuring all switch statements on enums explicitly handle every case. Removing default cases from fully covered enum switches. Refactoring optional enum handling (e.g., using if let instead of switch). None of these resolved the issue. Any guidance would be greatly appreciated! Project details: Xcode: 16.2 Swift: 6 iOS Target: 17.0+ UI: SwiftUI-only (no UIKit) Dependencies: SwiftPM
0
1
291
Mar ’25
Error Apple Git-154
I have an error when I use Apple Git-154 to clone the repository: My OS version: Sequoia 15.2 tannguyen@Mys-MacBook-Pro ~ % git -v git version 2.39.5 (Apple Git-154) tannguyen@Mys-MacBook-Pro ~ % git clone https://github.com/nestjs/nest.git Cloning into 'nest'... remote: Enumerating objects: 187515, done. remote: Counting objects: 100% (118/118), done. remote: Compressing objects: 100% (42/42), done. error: inflate: data stream error (incorrect data check)10 MiB/s fatal: pack has bad object at offset 212760331: inflate returned -3 fatal: fetch-pack: invalid index-pack output
0
0
359
Jan ’25
XCode Error Code: Failed to Save
I have a Mac Mini (M4) running macOS Sequoia 15.3.1. I very recently downloaded and installed the current version of XCode from the app store. I have not added any extensions - it's a vanilla, un-customized, un-enhanced installation. I have two user profiles (accounts) on my Mac: one Administrator and one Standard, each using a different apple account. I am using the Standard user account to learn XCode. When I attempt to set up a project, I get an error message when Xcode initially tries to save the (provided) project template file. The error states: "Failed to save Project2.xcodeproj. The backing file has been modified outside of XCode." I am using a NAS drive to store my project file. I have also tried saving it to the Desktop. It makes no difference to the error wherever the file is being saved. Similarly, I tried changing the Standard user account to an Administrator account to see if it was a privileges problem. Again, it made no difference to the error message. (So I changed the account back to a Standard user). I have tried googling the error but I only find references to problems related to extension/add-in products to XCode: none of which have I added to my XCode installation. I am attaching screenshots of the steps through the project creation process. Hopefully someone can tell me what I am doing wrong or what the problem is. Thank you.
0
0
306
Mar ’25
XCFrameworks deploying .a / include to output target directory
Hello Friends, We have a strange bug that Xcode is deploying static binaries from within .XCFramework into the CONFIGURATION_BUILD_DIR An example of our xcframeworks structure is: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>AvailableLibraries</key> <array> <dict> <key>BinaryPath</key> <string>libglfw3.a</string> <key>HeadersPath</key> <string>Headers</string> <key>LibraryIdentifier</key> <string>macos-arm64_x86_64</string> <key>LibraryPath</key> <string>libglfw3.a</string> <key>SupportedArchitectures</key> <array> <string>arm64</string> <string>x86_64</string> </array> <key>SupportedPlatform</key> <string>macos</string> </dict> </array> <key>CFBundlePackageType</key> <string>XFWK</string> <key>XCFrameworkFormatVersion</key> <string>1.0</string> </dict> </plist> for open source creative coding toolkit https://github.com/openframeworks/openFrameworks Can you see any issues in the above. Some ideas for me is to generate xcarchive instead of deploying the .a in the xcframeworks, however that does not explain the include being packaged there, so I think this might be a Xcode issue
0
0
169
Mar ’25
Xcconfig variables doesn't get loaded automatically in project settings
Hi, I am using xcode build that receive it's configuration using xcconfig files, those add some new definitions to the project, like the location of openssl library. If xcode environment variable include prefix that matches one of the fields in the project settings, it is automatically referred to as if you added it to that field. for example : the var HEADER_SEARCH_PATHS_openssl_libopenssl has value (openssl headers' path) that should be automatically added to the field Headers Search Paths under project settings. For some reason it stopped working for me and i'm not sure why (i've tried to release the xcconfig files). any idea why ? Thanks !
0
1
341
Jan ’25
Shared dependencies between test and production code creates library duplication
When test support code relies on production code, a diamond can occur. If this occurs across packages, it can lead to duplicated symbols and incorrect behavior at runtime despite no warnings at build time. This only occurs in Xcode and top-level application testing. This doesn't occur when the code being tested is in a separate package. I'm trying to understand how to correctly manage shared test support code which needs to access production code, or if this is the correct way and it is an Xcode bug. For a minimized example project, see https://github.com/rnapier/SupportCode. The setup includes three packages: Dependencies, which manages all the dependencies for the app and tests; Core which contains core logic and test support; and Feature, which relies on Core an contains feature-related logic and test support. Building this system causes Core.framework to show up three times in DerivedData: ./App.app/PlugIns/AppTests.xctest/Frameworks/Core_59974D35D_PackageProduct.framework ./App.app/Frameworks/Core_59974D35D_PackageProduct.framework ./PackageFrameworks/Core_59974D35D_PackageProduct.framework When unit tests are run, there is a collision on the symbol for Keychain: objc[48914]: Class _TtC8Keychain8Keychain is implemented in both /Users/ornapier/Library/Developer/Xcode/DerivedData/App-grdjljgevqofhqgflgtrqvhvbtej/Build/Products/Debug-iphonesimulator/PackageFrameworks/Core_59974D35D_PackageProduct.framework/Core_59974D35D_PackageProduct (0x100a98118) and /Users/ornapier/Library/Developer/CoreSimulator/Devices/216C441E-4AE5-45EC-8E52-FA42D8562365/data/Containers/Bundle/Application/7197F2F2-EB26-42FF-B7DB-67116159897D/App.app/PlugIns/AppTests.xctest/AppTests (0x1011002c0). One of the two will be used. Which one is undefined. This is not a benign warning. There are two distinct copies of _TtC8Keychain8Keychain and test cases will access one and the app will access a different one. This leads to mismatches when accessing static instances such as .shared. I believe this dependency graph should work, and it does work as long as the top-level testing system is a Swift module. But if it is the application, it builds successfully, but behaves incorrectly in subtle ways.
0
5
514
Feb ’25
Gathering Required Information for Troubleshooting Xcode Previews or Swift Previews Issues
Hi, You're here because your project has issues related to Xcode Previews or Swift Previews. The issue you're experiencing may be the result of any of the following: An error in your SwiftUI app, Xcode previews, or on-device previews. A configuration error in your Xcode project, including any third-party dependencies or packages. A system issue in the operating system, SwiftUI, or in Xcode Previews. Based on your request, I need more information about your SwiftUI app when rendering Xcode Previews or on-device previews. Specifically, I’ll need the diagnostics Swift Previews generates to make sure I understand the error encountered by the preview system. Please create a report in Feedback Assistant to share the details requested in the instructions below. For issues with macOS, Mac Catalyst, on-device iOS, or on-device visionOS previews, perform the following steps to gather diagnostics: Download and install the Swift Previews logging profile for your device. Reproduce the error while previewing on device, taking note of the timestamp when the error occurred. Attach the Previews diagnostics, sysdiagnose from your Mac, a sysdiagnose from the previewing iOS or visionOS device. For issues with Xcode Previews, perform the following steps to gather diagnostics: Download and install the Swift Previews logging profile for your device. Reproduce the error in Xcode Previews, if you haven’t already done so. If an error banner appears in the canvas, click the "Diagnostics" button within the banner, then go to Step 5; otherwise, continue to Step 4. If the error banner is missing, navigate to the menu in Xcode: Editor > Canvas > Diagnostics In the presented sheet, click the "Generate Report" button. Attach a zip file containing the diagnostic report to your bug report (it will be named something like previews-diagnostics-0123456789.zip). Submitting your feedback Before you submit to Feedback Assistant, please confirm the following information is included in your feedback: with the Swift Previews logging profile installed, attach the sysdiagnose logs gathered after reproducing the issue the Previews diagnostics generated by Xcode timestamp identifying when the issue was reproduced focused sample Xcode project that reproduces the issue (if applicable) screenshots or videos of the error (optional) Please include all requested information to prevent delays in my investigation. After your submission to Feedback Assistant is complete, please respond to your original Forums post with the Feedback ID. Once received, I can begin my investigation and determine if this issue is caused by an error within your SwiftUI app, a configuration issue within your Xcode project, or an underlying issue in the operating system, SwiftUI, in Xcode Previews, or on-device previews. Cheers, Paris X Pinkney |  WWDR | DTS Engineer
0
0
430
Feb ’25
How to make RealityKit both parent and child entities accessible to UI tests?
I have a SwiftUI RealityKit app, and I am writing UI tests for it. The app has entities that have children. All entities have an accessibilityComponent so that they can be found by UI tests. If I set isAccessibilityElement = true for the parent, the UI tests find the parent. If I set isAccessibilityElement = false for the parent, and isAccessibilityElement = true for the child, the UI tests find the child. If I set isAccessibilityElement = true for the parent as well as for the child, the UI tests find only the parent. How can I make parent and child entities both be accessible by the UI tests?
0
0
284
Feb ’25
WeatherKit in commandline app
I am trying to add WeatherKit support to a commandline app to fetch historical data. I've configured an app ID with the WeatherKit entitlement, but WeatherKit does not appear in the Capabilities list to add. When I try to access weather data, it fails with Code=4097 "connection to service named com.apple.weatherkit.authservice" suggesting it's not authorized. How do I add the WeatherKit entitlement to a commandline Swift app?
0
0
433
Dec ’24
Test Plans: application data for macOS apps
In the test plan settings, it's possible to select an .xcappdata bundle for a set of tests: I failed to find any documentation about it in the context of macOS apps testing. What I'm trying to achieve is having a sandboxed app container (/Users/{user}/Library/Containers/{bundle-id)/Data/) replaced before running a test suite. Is it something possible to achieve using the latest Xcode? What should be the .xcappdata structure to make it work on macOS?
0
1
280
Feb ’25
Fetch Changes not working Xcode 16.2
I have cloned a private repo from GitHub and for the most part it seems to be working fine. e.g. commit, push and pull are working. However, Fetch Changes doesn't seem to work at all. It pops up a brief message as if it is working, but the status of my local branch under the Source Control Navigator -> Repositories does not get updated. Even after a push, the status still tells me I am ahead on the local branch. If I add a new file on the GitHub website, Fetch Changes will not see it and the repository status remains unchanged. All of these changes are immediately visible in 'Fork' (3rd party Git GUI). If I restart Xcode the status is updated correctly, but it does not keep up with further changes. Anything I can do other than avoid using Xcode for GitHub tasks? Update: This might just be a problem with the Source Control Navigator views not updating. I just found that if I change branch, the "Repositories" section will not reflect the branch change until I exit and re-enter that view. e.g. click on "Changes" and back into "Repositores" to see the update. That workaround does not impact the out of date repo status though (how many commits am I ahead or behind). Seems very buggy...
0
2
327
Jan ’25