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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

A Summary of the WWDC25 Group Lab - Developer Tools
At WWDC25 we launched a new type of Lab event for the developer community - Group Labs. A Group Lab is a panel Q&A designed for a large audience of developers. Group Labs are a unique opportunity for the community to submit questions directly to a panel of Apple engineers and designers. Here are the highlights from the WWDC25 Group Lab for Developer Tools. Will my project codebase be used for training when I use Xcode's intelligent assistant powered by cloud-based models? When using ChatGPT without logging in, your data will not be used to improve any models. If you log in to a ChatGPT account, this is based on your ChatGPT account settings, which allows you to opt-out (it defaults to on). When using Xcode with accounts for other model providers, you should check with the policies of your provider. And finally, at no point will any portion of your codebase be used to train or improve any Apple models. We'd love to make our SwiftUI Previews (and soon, Playgrounds) as snappy as possible. Is there any way to skip certain build steps, such as running linters? It seems the build environment is exactly the same (compared to a debug build), but maybe there's a trick. Starting with Xcode 16, SwiftUI previews use the exact same build artifacts as the regular build. The new Playgrounds support in Xcode 26 uses these build artifacts too. Shell script build phases are the most common thing that introduces extra build time, so as a first step, try turning off all shell script build phases (like linters) to get an idea if that’s the issue. If those build phases add significant time to your build, consider moving some of those phases into asynchronous steps, such as running linters before committing instead of on every build. If you do need a shell script build phase to run during your build, make sure to explicitly define the input and output files, as that is a huge way to improve your build performance. Are we able to provide additional context for the models, like coding standards? Documentation for third party dependencies? Documentation on your own codebase that explains things like architecture and more? In general, Xcode will automatically search for the right context based on the question and the evolving answer, as the model can interact multiple times with your project as it develops an answer. This will automatically pick up the coding style of the code it sees, and can include files that contain architecture comments, etc. Beyond automatic context, you can manually attach other documents, even if they aren't in your project. For example, you could make a file with rules and ideas and attach it, and it will influence the response. We are very aware of other kinds of automatic context like rule files, etc, though Xcode does not support these at this time. Once ChatGPT is enabled for Coding Intelligence in Xcode 26, and I sign into my existing ChatGPT account, will the ChatGPT Coding Intelligence model in Xcode know about chat conversations on Xcode development done previously in the ChatGPT Mac app? Xcode does not use information from other conversations, and conversations started in Xcode are not accessible in the web UI or ChatGPT app. Is there a plan to make SwiftUI views easier to locate and understand in the view hierarchy like UIKit views? SwiftUI uses a declarative paradigm to define your user interface. That allows you to specify what you want, with the system translating that into an efficient representation at runtime. Unlike traditional AppKit and UIKit, seeing the runtime representation of SwiftUI views isn't sufficient in order to understand why it's not doing what you want. This year, we introduced a SwiftUI Instrument that shows why things are happening, like view re-rendering. Is it possible to use the AI chat with ChatGPT Enterprise? My company doesn't allow us to use the general ChatGPT, only the enterprise version they have setup that prevents data from being leaked Yes, Xcode 26 supports logging into any existing ChatGPT account, including enterprise accounts. If that does not meet your needs, you can also setup a local server that implements the popular chat completions REST API to talk to your enterprise account how you need. Now that Icon Composer is here, how does it complement or replace existing vector design tools such as Sketch for icon design? Icon Composer complements your existing vector design tools. You should continue to create your shapes, gradients, and layers in another tool like Sketch, and compose the exported SVG layers in Icon Composer. Once you bring your layers into Icon Composer, you can then use it to influence the translucency, blur, and specular highlights for your icon. What’s one feature or improvement in the new Xcode that you personally think developers will love, but might not immediately discover? Maybe something tucked away or quietly powerful that’s flown under the radar so far? One feature we're particularly excited about is the new power profiler for iOS, which gives you further insights into the energy consumption of your app beyond what was possible with the energy instrument previously. You can learn more about how to use this instrument and how it can help you greatly reduce your apps battery usage in the documentation, as well as the session Profile and optimize power usage in your app. There were also improvements in accessibility this year with Voice Control, where you can naturally speak your Swift code to Xcode, and it understands the Swift syntax as you speak. To see it in action, take a look at the demonstration in What’s new in Xcode 26. We have a software advisory council that is very sensitive to having our private information going to the cloud in any form. What information do you have to help me guide Xcode and Apple Intelligence through the acceptance process? One thing you can do is configure a proxy for your enterprise that implementing the popular Chat Completions API endpoint protocol. When using a model provider via URL, you can use your proxy endpoint to inspect the network traffic for anything that you do not want sent outside of your enterprise, and then forward the traffic through the proxy to your chosen model provider. Are there list of recommended LLMs to use with Xcode via Intelligence/Local? I've tried Gemma3-12B, but.. I hope there are better options? Apple doesn't have a published list of recommended local models. This is a fast-moving space, and so a recommendation would become out of date very quickly as new models are released. We encourage you to try out the local model support in Xcode 26 with models that you find meet your needs, and let us and the community know! (continued below)
1
0
798
Jul ’25
WKWebView
I am using Xcode 15.2. I am loading a URL in a WKWebView, but a hand cursor appears above the web view. Scrolling up and down does not work. I tried adjusting the scroll bounds and isUserInteractionEnabled, but the hand cursor is still visible. How can I fix this?
0
0
132
Feb ’25
Firebase Phone Auth OTP not working on TestFlight
Hi, I'm working in unity and I've implemented Firebase Phone Number Authentication in it. Everything works fine when I directly install build from xCode. App Attest screen shows up, user receives OTP on their phone and login works. But when I download the same build from TestFlight, it gets stuck after the user sends OTP request. I've added Push Notifications and App Attest in capabilities. I've also additionally added Remote Notifications. In device log I see an error about mobile provisioning file but I've added that to my account also. Is this expected behavior that phone number authentication does not work on TestFlight? If yes, how can I get this approved from apple since they need to test it before approving it. Thanks!
0
0
222
Feb ’25
Distribution and Apple TV Question
Hi, This maybe somewhat confusing, but please bear with me. I currently have an app in the App Store that supports iOS and tvOS. But the tvOS version was a separate app during the development process. I'd like to combine the iOS and tvOS app into one project so its easier to handle and keep track of internally. Can I upload the new Apple TV version to the same place where the current one is, or would I have to delete the current Apple TV version before uploading the newly combined version? I hope I made that clear enough :-) Thank you, Dan Uff
0
0
70
Apr ’25
Cannot assign build target to usdz file
I’m working in the app playground and want to add my usdz file but when i drag drop the file to my main folder i cannot add target to it which leads to a resource not found error while I build my app. It was working on a normal xcode project but while transitioning to app playground it is not working. How can I fix this issue?
0
0
387
Jan ’25
SchemeBuildError: Failed to build the scheme
I have an iOS app, and I am trying to add a companion WatchOS app. My iOS app depends on 2 libraries: GoogleMobileAds FirebaseAnalyticsWithoutAdIdSupport When I add a new target for WatchOS, the preview build starts to fail. I am not adding any libraries to WatchOS. The Google Ads and Firebase Analytics libs are only under the iOS target. I am unable to run the preview, I get an error when trying to build the watch scheme. The preview does not work. The build just crashes. I've included the error log below. But, here are the steps I've tried so far: Delete folders inside Derived Data Run a clean build (Cmd + Option + Shift + K) Delete scheme and create a new one Reset Package Cache Restart Xcode Restart Macbook But, it just does not work. I do not understand why the watchOS target is erroring for "GoogleUserMessagingPlatform" and "GoogleMobileAdsTarget" when those packages are not linked/used for the watchOS. SchemeBuildError: Failed to build the scheme “timerWatch Watch App” While building for watchOS Simulator, no library for this platform was found in '/Users/k/Library/Developer/Xcode/DerivedData/timer-dhkdhvfcqtfgskfdxpmupujswtuh/SourcePackages/artifacts/swift-package-manager-google-user-messaging-platform/UserMessagingPlatform/UserMessagingPlatform.xcframework'. (in target 'UserMessagingPlatformTarget' from project 'GoogleUserMessagingPlatform') Build target UserMessagingPlatformTarget: /Users/k/Library/Developer/Xcode/DerivedData/timer-dhkdhvfcqtfgskfdxpmupujswtuh/SourcePackages/artifacts/swift-package-manager-google-user-messaging-platform/UserMessagingPlatform/UserMessagingPlatform.xcframework:1:1: error: While building for watchOS Simulator, no library for this platform was found in '/Users/k/Library/Developer/Xcode/DerivedData/timer-dhkdhvfcqtfgskfdxpmupujswtuh/SourcePackages/artifacts/swift-package-manager-google-user-messaging-platform/UserMessagingPlatform/UserMessagingPlatform.xcframework'. (in target 'UserMessagingPlatformTarget' from project 'GoogleUserMessagingPlatform') Build target GoogleMobileAdsTarget: /Users/k/Library/Developer/Xcode/DerivedData/timer-dhkdhvfcqtfgskfdxpmupujswtuh/SourcePackages/artifacts/swift-package-manager-google-mobile-ads/GoogleMobileAds/GoogleMobileAds.xcframework:1:1: error: While building for watchOS Simulator, no library for this platform was found in '/Users/k/Library/Developer/Xcode/DerivedData/timer-dhkdhvfcqtfgskfdxpmupujswtuh/SourcePackages/artifacts/swift-package-manager-google-mobile-ads/GoogleMobileAds/GoogleMobileAds.xcframework'. (in target 'GoogleMobileAdsTarget' from project 'GoogleMobileAds')
0
0
85
Apr ’25
Xcode crash reports from TestFlight
My application is in flightTest mode. I received my first two crash reports in XCODE /Organizer. The context is well described, and I was able to isolate the locations where very serious errors occurred. My application is connected. I'm missing one piece of data in this crash report: the time of the crash. This will help me see what (in my case) static data was being read on the data server at that time. This will help me investigate. Is it possible to obtain this information?
0
0
78
Mar ’25
Is debugging with App Data broken?
Trying to use App Data on Xcode 16.2, and failing I'm running the app with the debugger. When I run the app, I need to do a handful of things, which affects my app's cache files, and UserDefaults. What I'd like to do is store all of these settings, then have them loaded in when the app launches, so I don't need to do same, tedious work of changing settings by hand in the UI. So, I discovered that I can provide an xcappdata directory in the Run options. This seems like exactly what I'm looking for. But I can't seem to get it to work. Like, when the app runs, it looks like none of those settings are brought in. I ran the app on a device, and pulled down the application data, and then put that in the project. And you can see in the screenshot, that the value is set. So, either I'm missing something (which is totally possible) or this feature is broken. Documentation on this is not great, so maybe I'm doing something wrong. If the feature is known to be broken, I'll give up on this. But if it should work, it would be great to get some tips here.
0
0
224
Jan ’25
Spatial audio personalised profile access entitlement "not available on iOS"
I followed this guide, and added com.apple.developer.spatial-audio.profile-access as an entitlement to the app (via the + Capability button – Spatial Audio Profile). I have a audio graph that outputs to AVAudioEngine. However, the Xcode Cloud build ended up with this error: Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on iOS. Specifically, key 'com.apple.developer.spatial-audio.profile-access' in 'Payload/…' is not supported. This guide says it's available on iOS. Does it mean not on iOS 17? In which case how can I provide fallback for iOS 17?
0
0
440
Jan ’25
No drop in NSView
Since dragImage: is deprecated I am trying to update drag and drop with beginDraggingSessionWithItems:. Drag work fine but I cannot get drop to work correctly. In the code below change #ifndef to #ifdef (using dragImage:) make drop work as expected. draggingEntered, draggingUpdated, draggingExited, draggingEnded are all called but NOT performDragOperation (which do the drop). Uncommenting the line [pb_item pasteboard:paste_board provideDataForType:@"LN_PboardType"]; cause an exceptionPreprocess: -[NSPasteboardItem pasteboard:provideDataForType:]: unrecognized selector sent to instance 0x600001e64240. I also try add NSDraggingDestination, NSItemProviderWriting, NSPasteboardTypeOwner to @interface line without success. What I am doing wrong ? Any other method to do Drag and Drop (other than dragImage: and beginDraggingSessionWithItems:) ? Where can I found an Obj-C project using beginDraggingSessionWithItems: for drag an drop ? ``@interface Enclosure : NSView <NSDraggingSource, NSPasteboardItemDataProvider> - (id)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { [super setAutoresizesSubviews:YES]; [self registerForDraggedTypes:[NSArray arrayWithObjects:@"LN_PboardType", NSPasteboardTypeString, nil]]; } return self; } - (BOOL)acceptsFirstMouse:(NSEvent *)event { return YES; } - (void)mouseDown:(NSEvent *)drag_event { NSImage *drag_image; NSPoint drag_position; NSRect dragging_rect; NSPasteboard *paste_board; NSDraggingItem *drag_item; NSArray *items_array; NSPasteboardItem *pb_item; paste_board = [NSPasteboard pasteboardWithName:@"LN_PboardType"]; [paste_board declareTypes:[NSArray arrayWithObjects:@"LN_PboardType", NSPasteboardTypeString, nil] owner:self]; pb_item = [[NSPasteboardItem alloc] init]; [pb_item setDataProvider:self forTypes:[NSArray arrayWithObjects:@"LN_PboardType", NSPasteboardTypeString, nil]]; // [pb_item pasteboard:paste_board provideDataForType:@"LN_PboardType"]; drag_image = [ [NSImage imageNamed:@"drag.jpg"]; drag_position = [self convertPoint:[drag_event locationInWindow] fromView:nil]; drag_position.x -= drag_image.size.width/2; drag_position.y -= drag_image.size.height/2; #ifndef DEPRECATED [self dragImage:drag_image at:drag_position offset:NSZeroSize event:drag_event pasteboard:paste_board source:self slideBack:YES]; #else drag_item = [[NSDraggingItem alloc] initWithPasteboardWriter:pb_item]; dragging_rect = NSMakeRect(drag_position.x, drag_position.y, drag_image.size.width, drag_image.size.height); [drag_item setDraggingFrame:dragging_rect contents:drag_image]; items_array = [NSArray arrayWithObject:drag_item]; [self beginDraggingSessionWithItems:items_array event:drag_event source:(id)self]; #endif } - (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context { if (disable_drag_and_drop) return NSDragOperationNone; switch (context) { case NSDraggingContextWithinApplication: return NSDragOperationCopy; case NSDraggingContextOutsideApplication: return NSDragOperationMove; } return NSDragOperationNone; } …``
0
0
205
Feb ’25
Executable Path is a Directory
My build succeeded but I immediately got the following pop-up error: Executable Path is a Directory Domain: DVTMachOErrorDomain Code: 5 Recovery Suggestion: /Users/myname/Library/Developer/Xcode/DerivedData/Myapp-dwsmxozkmjfflagroxubgbfvahwq/Build/Products/Debug-iphonesimulator/Myapp.app is not a valid path to an executable file. User Info: {DVTErrorCreationDateKey = "2025-04-17 11:54:27 +0000"} Executable Path is a Directory Domain: DVTMachOErrorDomain Code: 5 Recovery Suggestion: /Users/myname/Library/Developer/Xcode/DerivedData/Myname-dwsmxozkmjfflagroxubgbfvahwq/Build/Products/Debug-iphonesimulator/Myname.app is not a valid path to an executable file. System Information macOS Version 15.5 (Build 24F5053f) Xcode 16.3 (23785) (Build 16E140) Applied and Failed Fixes: Upgrade to MacOS 15.5 Beta pod deintegrate/podinstall uninstall and reinstall Xcode Delete DerivedData folder Edit info.plist Executable File name
0
0
142
Apr ’25
Swift Package Manager - Package Download Issue
We have developed a custom iOS framework called PaySDK. Earlier we distributed the framework as PaySDK.xcframework.zip through GitHub (Private repo) with two dependent xcframeworks. Now, one of the clients asking to distribute the framework through Swift Package Manager. I have created a new Private repo in the GitHub, created the new release (iOSSDK_SPM_Test) tag 1.0.0. Uploaded the below frameworks as Assets and updated the downloadable path in the Package.Swift and pushed to the GitHub Main branch. PaySDK.xcframework.zip PaySDKDependentOne.xcframework.zip PaySDKDependentTwo.xcframework.zip When I try to integrate (testing) the (https://github.com/YuvaRepo/iOSSDK_SPM_Test) in Xcode, am not able to download the frameworks, the downloadable path is pointing to some old path (may be cache - https://github.com/YuvaRepo/iOSSDK_SPM/releases/download/1.2.0/PaySDK.xcframework.zip). Package.Swift: // swift-tools-version:5.3 import PackageDescription let package = Package( name: "iOSSDK_SPM_Test", platforms: [ .iOS(.v13) ], products: [ // Products define the executables and libraries a package produces, making them visible to other packages. .library( name: "iOSSDK_SPM_Test", targets: ["PaySDK", "PaySDKDependentOne", "PaySDKDependentTwo"] ) ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. // Targets can depend on other targets in this package and products from dependencies. .binaryTarget( name: "PaySDK", url: "https://github.com/YuvaRepo/iOSSDK_SPM_Test/releases/download/1.0.0/PaySDK.xcframework.zip", checksum: " checksum " ), .binaryTarget( name: "PaySDKDependentOne", url: "https://github.com/YuvaRepo/iOSSDK_SPM_Test/releases/download/1.0.0/PaySDKDependentOne.xcframework.zip", checksum: " checksum " ), .binaryTarget( name: "PaySDKDependentTwo", url: "https://github.com/YuvaRepo/iOSSDK_SPM_Test/releases/download/1.0.0/PaySDKDependentTwo.xcframework.zip", checksum: " checksum " ), .testTarget( name: "iOSSDK_SPM_TestTests", dependencies: ["PaySDK", "PaySDKDependentOne", "PaySDKDependentTwo"] ) ] ) Steps I followed: I have tried below steps, Removed the local repo and cloned new rm -rf ~/Library/Caches/org.swift.swiftpm/ rm -rf ~/Library/Developer/Xcode/DerivedData/* Can anyone help to identify the issue and resolve? Thanks in advance.
0
0
424
Jan ’25
How to retrieve required Apple Pay parameters for PayFort payment request in Swift?
I'm integrating Apple Pay with PayFort in a Swift iOS application, and I’m currently working on preparing a valid purchase request using Apple Pay, as described in PayFort’s documentation: 🔗 https://docsbeta.payfort.com/docs/api/build/index.html?shell#apple-pay-authorization-purchase-request The documentation outlines the following required parameters: apple_data apple_signature apple_header apple_transactionId apple_ephemeralPublicKey apple_publicKeyHash apple_paymentMethod apple_displayName apple_network apple_type Optional: apple_applicationData I understand these should be derived from the PKPayment object after Apple Pay authorization, but I’m having trouble mapping everything correctly. Here’s what I’m seeing in code: payment.token // Returns something like: <PKPaymentToken: 0x28080ae80; transactionIdentifier: "..."; paymentData: 3780 bytes> payment.token.paymentData // Contains 3780 bytes of encrypted data payment.token.paymentData.base64EncodedString() // Returns a long base64 string, which at first glance seems like it could be used for apple_data, // but PayFort doesn't accept it as-is — so this value appears to be incomplete or incorrectly formatted I can successfully retrieve the following values from payment.token.paymentMethod: apple_displayName apple_network apple_type However, I’m still unsure how to extract or build the following in the format accepted by PayFort: apple_data apple_signature apple_header apple_transactionId apple_ephemeralPublicKey apple_publicKeyHash apple_paymentMethod These may be contained within the paymentData JSON, but I’m not sure how to decode it or if Apple allows decrypting it in a way that matches PayFort’s expected format. How can I correctly extract or build apple_data, apple_signature, and apple_header from the Apple Pay token? Also, how should I handle the decryption or decoding (if necessary) of paymentData to retrieve values like apple_transactionId, apple_ephemeralPublicKey, and apple_publicKeyHash? If anyone has successfully set this up or has example code that bridges Apple Pay and PayFort’s expected request format, it would be super helpful! Thanks in advance 🙏
0
0
71
Apr ’25
Xcode 16.1 hang after adding Store Kit configuration
I don't know Xcode very well, and had been using it sporadically to test a project exported from Unity. I recently added a StoreKit Configuration to the project, and since then it gives me ≈10s after launching before the beach ball appears, and it never leaves. Xcode says it is "Indexing" but I don't know if that's an obvious culprit. I can still build my project via the fastlane tool, on the command line, and the newly-added StoreKit configuration works just fine. But I cannot use Xcode interactively any more, unless I re-export the project from Unity. The only difference between it working and hanging is the Store Kit configuration. How do I understand what's going on, and (ideally) fix it? The Activity Monitor gives a bunch of backtraces that don't have an obvious network or I/O culprit in them.
0
0
70
Apr ’25
Xcode - Command "Find Selected Symbol in Workspace" gives no result
Example: I have a state var curHighScore declared in ContentView. I select it, right click and select "Find Selected Symbol in Workspace" The result is : 1 resul in 1 file, i.e. the line of declaration of the var But obviously, the same var is used at line #102: How come this occurence is not found by the search command. Such happens every now and then. Is there something I am missing ? What is causing this ? Thanks for your help.
0
1
221
Feb ’25
Xcode 16 Automatically Builds & Runs Simulator While Editing Storyboard
I’m experiencing an issue in Xcode 16 where the app randomly builds and runs in the simulator while I’m designing items in the storyboard. Here’s what I’ve tried so far to stop this behavior: Disabled "Show Live Issues" in the General settings Removed all key bindings related to Build & Run in the Key Bindings settings Checked for unintentional shortcut triggers, but nothing seems to be causing it Update XCode from 16.1 to 16.2 Delete Derived Data Despite these actions, Xcode still automatically builds and launches the simulator at unexpected times, disrupting my workflow. Is there any setting or hidden configuration that could be causing this? How can I completely prevent Xcode from running the simulator automatically while editing UI in the storyboard? Would really appreciate any guidance on this!
0
0
99
Mar ’25
Any solution yet to not being able to turn off debugging via WiFI?
Debugger on Xcode 16.x is super slow and it turns out it's only this way when Xcode is connected to my iPhone via WiFi. If I disable WiFI on my iPhone everything is just fine. But that's not a solution. An engineer posted this supposed solution, https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes. Forgive me but that's not a solution, especially since we used to be able to shut off "Connect via WiFI." I've seen so many posts here and everywhere else with no one stating any clear answer. Does anyone know why has this been removed? And is anyone aware of it? I've posted in the Feedback Asst. as many others have. What gives?
0
1
225
Jan ’25