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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

Metal GPU capture
I'm trying to get performance information in a Metal cpp program. I'm using Xcode 14.2. In the Counters tab, only the inscription No Data appears. What could be the problem, what am I doing wrong? The libraries Metal, MetalKit, AppKit are connected. The code is taken from the Apple website from the Learn Metal with C++ section.
1
0
487
Dec ’24
Updating EditButton
I am trying to update the EditButton after deleting rows in a List, but its title doesn't change. I have sent an update event via a publisher that applies the mode change based on the number of items remaining in the list. Here's the update event handler: .onReceive(updateViewPublisher, perform: { _ in self.editMode?.wrappedValue = textFileData.textFiles.count == 0 ? .inactive : .active update += 1 })``` The edit mode is changed to inactive when the list is empty, but the button continues to display 'done'. If I adda new list item it remains set to 'done' and the delete control is displayed against the new item. I have seen loads of posts about this on various sites, but no solutions. I am trying this on Xcode 16.2 and IOS 18.2. If someone from Apple sees this, a reply would be most welcome.
2
0
311
Dec ’24
XLSXWriter Help
Hello, I am brand new to development in Xcode. I have created a Mac app that I need to use XLSXWriter to export a workbook and sheet. Is GitHub the only place for this download or is there an apple developer specific area to get the library? Thanks
0
0
132
Jan ’25
Verification Error in Production: Should I Submit My App with the Backend in Sandbox Mode?
Hello, My payment system works correctly when my backend is in sandbox mode, but when I submit my app for review, I get the following error: VerificationException [Error] at SignedDataVerifier.verifyNotification (/Users/---/node_modules/@apple/app-store-server-library/dist/jws_verification.js:126:19) at SignedDataVerifier.verifyAndDecodeNotification (/Users/---/node_modules/@apple/app-store-server-library/dist/jws_verification.js:121:14) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async file:///Users/---/src/api/routes/apple.routes.js:22:18 { status: 2, cause: undefined } Main Question For Apple to approve in-app purchases, should I submit my app for review with the backend in sandbox mode or production? Possible Causes of the Error I would appreciate any suggestions on what might be causing this error and how to fix it. Thanks in advance! 🚀
1
0
205
Feb ’25
Using isActivityFullscreen to build applications in xcode 16 will crash in ios 17
My widget uses the @Environment(.isActivityFullscreen) variable. When running on ios 17, it will crash and report an error: dyld[55031]: Symbol not found: _$s7SwiftUI17EnvironmentValuesV9WidgetKitE20isActivityFullscreenSbvg Expected in: /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WidgetKit.framework/WidgetKit
1
0
298
Jun ’25
Configure Format to Multiple Lines?
Is there any way to modify the behaviour of this command? I really dislike that it adds a break after the opening parenthesis and would also prefer it to use the traditional multi-line style where the lines are aligned with their semicolons. Alternatively, is there a way to run the "Format File with 'swift-format'" command without implicitly triggering "Format to Multiple Lines", as it apparently does? Having to reformat my method's signatures afterwards really makes this feature unattractive to me at the moment.
0
0
144
Jan ’25
NWPathMonitor : Lost connection to the debugger
I tried to monitor the device's network status with Network framework code below. let networkMonitor = NWPathMonitor(requiredInterfaceType: .cellular) networkMonitor.pathUpdateHandler = { [weak self] path in     if path.status == .satisfied {         print("Cellular Satisfied")     } else {         print("Cellular Unsatisfied")     } } When I run the app in my iPhone(iOS 15.5) and turn cellular on/off, iPhone suddenly loses connection with XCode. Lost connection to the debugger on “...'s iPhone”. Domain: IDEDebugSessionErrorDomain Code: 12 Recovery Suggestion: Restore the connection to “...'s iPhone” and run “...” again, or if “...” is still running, you can attach to it by selecting Debug > Attach to Process > .... User Info: {     DVTErrorCreationDateKey = "2022-06-23 02:16:30 +0000";     IDERunOperationFailingWorker = DBGLLDBLauncher; } Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : {     "device_model" = "iPhone13,2";     "device_osBuild" = "15.5 (19F77)";     "device_platform" = "com.apple.platform.iphoneos";     "launchSession_schemeCommand" = Run;     "launchSession_state" = 2;     "launchSession_targetArch" = arm64;     "operation_duration_ms" = 5861;     "operation_errorCode" = 12;     "operation_errorDomain" = IDEDebugSessionErrorDomain;     "operation_errorWorker" = DBGLLDBLauncher;     "operation_name" = IDEiPhoneRunOperationWorkerGroup;     "param_consoleMode" = 0;     "param_debugger_attachToExtensions" = 0;     "param_debugger_attachToXPC" = 1;     "param_debugger_type" = 5;     "param_destination_isProxy" = 0;     "param_destination_platform" = "com.apple.platform.iphoneos";     "param_diag_MainThreadChecker_stopOnIssue" = 0;     "param_diag_MallocStackLogging_enableDuringAttach" = 0;     "param_diag_MallocStackLogging_enableForXPC" = 1;     "param_diag_allowLocationSimulation" = 1;     "param_diag_gpu_frameCapture_enable" = 0;     "param_diag_gpu_shaderValidation_enable" = 0;     "param_diag_gpu_validation_enable" = 0;     "param_diag_memoryGraphOnResourceException" = 0;     "param_diag_queueDebugging_enable" = 1;     "param_diag_runtimeProfile_generate" = 0;     "param_diag_sanitizer_asan_enable" = 0;     "param_diag_sanitizer_tsan_enable" = 0;     "param_diag_sanitizer_tsan_stopOnIssue" = 0;     "param_diag_sanitizer_ubsan_stopOnIssue" = 0;     "param_diag_showNonLocalizedStrings" = 0;     "param_diag_viewDebugging_enabled" = 1;     "param_diag_viewDebugging_insertDylibOnLaunch" = 1;     "param_install_style" = 0;     "param_launcher_UID" = 2;     "param_launcher_allowDeviceSensorReplayData" = 0;     "param_launcher_kind" = 0;     "param_launcher_style" = 0;     "param_launcher_substyle" = 0;     "param_runnable_appExtensionHostRunMode" = 0;     "param_runnable_productType" = "com.apple.product-type.application";     "param_runnable_swiftVersion" = "5.6";     "param_runnable_type" = 2;     "param_testing_launchedForTesting" = 0;     "param_testing_suppressSimulatorApp" = 0;     "param_testing_usingCLI" = 0;     "sdk_canonicalName" = "iphoneos15.4";     "sdk_osVersion" = "15.4";     "sdk_variant" = iphoneos; } In my opinion, it seems like an error of XCode. Plz let me know if there's any solution. Also, there's a similar issue here : https://developer.apple.com/forums/thread/681459
7
0
1.4k
Feb ’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
Gaps in Xcode build timeline
Reposting (after a while) from the Swift forums - the build timeline for our project has a lot of weird gaps in the beginning - almost 15 seconds in total, which is quite a big chunk of the total build time. Is there any way to determine why they exist or how I could fix them? I hope it's just something hidden and not the build system literally doing nothing... This is on Xcode 15.4.
1
0
446
Mar ’25
My app stops at 90% on testfight and doesn't download
I am creating an imessage sticker pack and I am having an issue with an update of my app. It publishes to test flight but I can't download it to test. My app has an extension of imessage. I have tried: Checking the size of the animated stickers. All are below 500kb My version number is 4.1.1. so no 0 I am really no sure what to do. Any suggestions would be appreciated.
0
0
211
Jan ’25
Xcode version 14.2 crashes as soon as opened in mac os 15.0.1
I have downloaded xcode version 14.2 from apple official archive. I ran xcode using these steps: Right click -> Show Package content Go to folder Contents -> Macos -> Xcode Run the xcode terminal app After this as soon as I try to open a project, xcode crashes. How do i run xcode of lower version as that specific version is required, I don't want to downgrade my macos as it will result in clearing my data or I have to transfer data. Please help me with this issue.
1
0
342
Dec ’24
Affiliate View Struct is probably hidden by Charts on iOS app
The problem is: As per screenshot below, one can only see the lineChart. I have another struct AffiliateView coded under this Chart: import SnapKit import Charts import DGCharts class AffiliateViewController: UIViewController { private lazy var chartView: LineChartView = { let chart = LineChartView() chart.noDataText = "No data available." chart.chartDescription.enabled = false chart.xAxis.labelPosition = .bottom chart.rightAxis.enabled = false chart.legend.enabled = true chart.backgroundColor = .lightGray // For debugging visibility return chart }() private lazy var containerView: UIView = { let view = UIView() view.backgroundColor = .white return view }() override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .white // Add container view and chart view to the main view view.addSubview(containerView) view.addSubview(chartView) // Add SwiftUI View inside the container view let affiliateView = AffiliateView() let hostingController = UIHostingController(rootView: affiliateView) addChild(hostingController) containerView.addSubview(hostingController.view) hostingController.view.frame = containerView.bounds hostingController.didMove(toParent: self) layout() setupChartData() } private func layout() { // Layout the container view (SwiftUI content) containerView.snp.makeConstraints { make in make.top.equalTo(view.safeAreaLayoutGuide.snp.top) make.left.right.equalToSuperview() make.height.equalTo(350) // Increase the height for the SwiftUI content } // Layout the chart view below the container view chartView.snp.makeConstraints { make in make.top.equalTo(containerView.snp.bottom).offset(20) // Space between chart and the affiliate content make.left.equalToSuperview().offset(20) make.right.equalToSuperview().offset(-20) make.height.equalTo(200) // Set a fixed height for the chart } } private func setupChartData() { let dataEntries = [ ChartDataEntry(x: 1, y: 10), ChartDataEntry(x: 2, y: 20), ChartDataEntry(x: 3, y: 15), ChartDataEntry(x: 4, y: 30), ChartDataEntry(x: 5, y: 25) ] let dataSet = LineChartDataSet(entries: dataEntries, label: "Clicks per Day") dataSet.colors = [.blue] dataSet.valueColors = [.black] dataSet.circleColors = [.red] dataSet.circleRadius = 4.0 let data = LineChartData(dataSet: dataSet) chartView.data = data chartView.notifyDataSetChanged() } } // SwiftUI View remains in the same file struct AffiliateView: View { @State private var customMessage: String = "" @State private var uniqueLink: String = "Your unique link will appear here." @State private var clickData: [Double] = [10, 20, 15, 30, 25] // Example data var body: some View { NavigationView { VStack(spacing: 20) { // TextField for custom message input TextField("Enter your custom message...", text: $customMessage) .textFieldStyle(RoundedBorderTextFieldStyle()) .padding(.horizontal) // Generate Link Button Button(action: generateLink) { Text("Generate Sign-Up Link") .font(.headline) .foregroundColor(.white) .frame(maxWidth: .infinity, maxHeight: 50) .background(Color.red) .cornerRadius(10) } .padding(.horizontal) // Generated Link Label Text(uniqueLink) .font(.body) .multilineTextAlignment(.center) .padding(.horizontal) // You can add a chart here if you want to show it in SwiftUI too /* LineChartView(data: clickData, title: "Clicks per Day", legend: "Daily Clicks") */ } .navigationTitle("Affiliate Marketing") .navigationBarTitleDisplayMode(.inline) } } private func generateLink() { let encodedMessage = customMessage.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? "" uniqueLink = "https://affiliate.example.com/referral?message=\(encodedMessage)" addClickData() } private func addClickData() { clickData.append(Double.random(in: 0...100)) } } As you see, the AffiliateView has been declared outside of Controller View class. The View content was visible before the lineChart was added into this code. Now the View content is not visible anymore. I have tried to increment/decrement values at make.height.equalTo() but to no avail. Could anyone kindly point me in the right direction?
0
0
305
Jan ’25
Why does Xcode's Minimum Deployments only let you select N.6?
I want to set the minimum deployment to 16.0, however Xcode (16.2) won't let me select that. In the drop down box it shows 18,17,16,15, however if any of these is selected it sets them as 18.6, 17.6, 16.6 or 15.6 (see image) If an attempt is made to edit the value manually, to 16.0, then after change it, Xcode just deletes that value and sets it to nothing. What's going on here? Why is Xcode only allowing the version other than be something.6 and why will it not let you manually edit it?
1
0
454
Jan ’25
Troubleshooting Apple Vision Framework Errors
When working on the project "Analyzing a Selfie and Visualizing Its Content" from Apple's documentation, I downloaded the project and opened it in Xcode. However, I encountered the following error: VTEST: error: perform(_:): inside 'for await result in resultStream' error: internalError("Error Domain=com.apple.Vision Code=9 \"Could not create inference context\" UserInfo={NSLocalizedDescription=Could not create inference context}") VTEST: error: DetectFaceRectanglesRequest was cancelled. VTEST: error: DetectFaceRectanglesRequest was cancelled. Error Domain=com.apple.Vision Code=9 "Could not create inference context" UserInfo={NSLocalizedDescription=Could not create inference context} How can I resolve this issue? Thanks in advance!
1
0
379
Feb ’25
How to build an iOS app using the command line on macOS Sonoma?
Hello, Now we support Apple applications and we are building applications on Mac laptops with regular updates. Our goal is to build an iOS app entirely through the command line using xcodebuild and other tools from Xcode Command Line Tools on a server with _macOS Sonoma (14.6.1) without a graphical user interface (only the command line)!!! We need to build and regularly update iOS applications on clients and our accounts and we are looking for a solution to fully automate the login process for these accounts. Our goal is to automate these processes on a server without involving a customer. Here’s what I need help with building and signing the app: What are the proper commands to build and sign the app using xcodebuild and put this application in Apple Store? Server has: xcode-select -version xcode-select version 2408. xcodebuild -version Xcode 16.1 Build version 16B40. In the first step, the certificates have been added to the keychain. We have two keychains. We can check it by running the command: security list-keychains: ` "/Users/ec2-user/Library/Keychains/login.keychain-db" "/Library/Keychains/System.keychain".` All certificates are kept in login.keychain-db. We can check it: security find-identity -p codesigning -v Answer is: `'Some hash "Apple Distribution: Name. (TEAM ID)"'.` Profision file is kept in /Users/ec2-user/Library/MobileDevice/Provisioning\ Profiles/. In the first step, we have added a cordova platform with iOS 11 version. Command is: cordova platform add ios. We tried to create a sign archive with automation but we couldn't do it because we got an error. Our command is xcodebuild \ -workspace "path/to/Packet-name Test.xcworkspace" \ -scheme "Packet-name Test" \ -sdk iphoneos \ -configuration Release \ -archivePath "./Packet-name Test.xcarchive" \ CODE_SIGN_STYLE=Automatic \ DEVELOPMENT_TEAM=XXXXXXXXXX \ -allowProvisioningUpdates \ archive We get errors: /Users/ec2-user/buildApps/MyNewApplication/packet-name.test/platforms/ios/Packet-name Test.xcodeproj: error: No Accounts: Add a new account in Accounts settings. (in target 'Packet-name Test' from project 'Packet-name Test') /Users/ec2-user/buildApps/MyNewApplication/packet-name.test/platforms/ios/Packet-name Test.xcodeproj: error: No profiles for 'packet-name.test' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'packet-name.test'. (in target 'Packet-name Test' from project 'Packet-name Test') We've read about this error so the decision is to create one-time passwords for this. Certainly last error is about a problem with login, but how we can fix it we don't know because we will be using different accounts for different applications. As a result, we have to use one-time passwords for different accounts. We would appreciate detailed instructions, example commands, and references to documentation that might address this workflow.
1
0
333
Feb ’25
DriverKit XCode compilation errors
I'm working on dext project (c++), Base SDK and Supported Platforms are set to DriverKit. #include causes errors: error "The iostreams library is not supported since libc++ has been configured without support for localization." error "<locale.h> is not supported since libc++ has been configured without support for localization." Also it's not possible to define custom log object: undeclared identifier 'os_log_create'. <os/log.h> included and os_log function is compiled correct. macOS as additional SDK did not help. Thanks a lot for any hint.
1
0
494
Apr ’25