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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

Swift, kevent, and wth?!?!?
I have this code: var eventIn = kevent(ident: UInt(self.socket), filter: Int16(EVFILT_WRITE), flags: UInt16((EV_ADD | EV_ENABLE)), fflags: 0, data: 0, udata: nil ) I looked at it and thought why do I have those extra parentheses? So I changed it to var eventIn = kevent(ident: UInt(self.socket), filter: Int16(EVFILT_WRITE), flags: UInt16(EV_ADD | EV_ENABLE), // changed line! fflags: 0, data: 0, udata: nil ) and then kevent gave me EBADF. Does this make sense to anyone?
0
0
242
Feb ’25
The UT coverage does not include branch coverage for swift
We using below command to run unit test and collect coverage: xcodebuild -workspace Demo.xcworkspace -scheme VideoTests -configuration Debug -derivedDataPath ../build/derivedData -destination 'platform=iOS Simulator,id=E6630007-570B-4DEB-A023-2BCE91116A8D' -resultBundlePath './fastlane/test_output/VideoTests.xcresult' -enableCodeCoverage YES -testPlan 'Video' test-without-building | tee '/Users/rcadmin/Library/Logs/scan/VideoTests.log' | xcbeautify -q --is-ci and using xcrun llvm-cov show command to generate coverage report: xcrun llvm-cov show /build/unit-test/coverage/libraries/merged/video.o -instr-profile=/app/ios/build/derivedData/Build//ProfileData/E6630007-570B-4DEB-A023-2BCE91116A8D/video.profdata -show-branches count -show-expansions -show-line-counts -use-color -format=html -output-dir coverage and the html report does not include branch coverage: how to generate the branch coverage?
0
0
141
May ’25
AR Camera Freezes in Split View on iPad (Vuforia + Unity + iOS 16+)
Hi everyone, We're developing an AR app using Unity with Vuforia for object detection. Our app works well in full-screen mode, including detection and post-detection phases. However, we're facing a specific issue in iPad Split View multitasking mode. Problem: The AR camera (Vuforia-based) freezes during object detection if another app is opened in Split View. Post-detection, everything works fine in Split View. The problem only occurs during detection. Testing Environment: iPadOS 16+ Unity with Vuforia plugin Using EnableMultitaskingCameraAccess() method with AVFoundation to support camera multitasking AR scene is set up properly with detection capabilities in full-screen
0
0
132
May ’25
SFSpeechRecognizer is not working inside visionOS 2.4 simulator
I know there has been issues with SFSpeechRecognizer in iOS 17+ inside the simulator. Running into issues with speech not being recognised inside the visionOS 2.4 simulator as well (likely because it borrows from iOS frameworks). Just wondering if anyone has any work arounds or advice for this simulator issue. I can't test on device because I don't have an Apple Vision Pro. Using Swift 6 on Xcode 16.3. Below are the console logs & the code that I am using. Console Logs BACKGROUND SPATIAL TAP (hit BackgroundTapPlane) SpeechToTextManager.startRecording() called [0x15388a900|InputElement #0|Initialize] Number of channels = 0 in AudioChannelLayout does not match number of channels = 2 in stream format. iOSSimulatorAudioDevice-22270-1: Abandoning I/O cycle because reconfig pending iOSSimulatorAudioDevice-22270-1: Abandoning I/O cycle because reconfig pending iOSSimulatorAudioDevice-22270-1: Abandoning I/O cycle because reconfig pending iOSSimulatorAudioDevice-22270-1: Abandoning I/O cycle because reconfig pending iOSSimulatorAudioDevice-22270-1: Abandoning I/O cycle because reconfig pending iOSSimulatorAudioDevice-22270-1: Abandoning I/O cycle because reconfig pending SpeechToTextManager.startRecording() completed successfully and recording is active. GameManager.onTapToggle received. speechToTextManager.isAvailable: true, speechToTextManager.isRecording: true GameManager received tap toggle callback. Tapped Object: None BACKGROUND SPATIAL TAP (hit BackgroundTapPlane) GESTURE MANAGER - User is already recording, stopping recording SpeechToTextManager.stopRecording() called GameManager.onTapToggle received. speechToTextManager.isAvailable: true, speechToTextManager.isRecording: false Audio data size: 134400 bytes Recognition task error: No speech detected <--- Code private(set) var isRecording: Bool = false private var recognitionRequest: SFSpeechAudioBufferRecognitionRequest? private var recognitionTask: SFSpeechRecognitionTask? @MainActor func startRecording() async throws { logger.debug("SpeechToTextManager.startRecording() called") guard !isRecording else { logger.warning("Cannot start recording: Already recording.") throw AppError.alreadyRecording } currentTranscript = "" processingError = nil audioBuffer = Data() isRecording = true do { try await configureAudioSession() try await Task.detached { [weak self] in guard let self = self else { throw AppError.internalError(description: "SpeechToTextManager instance deallocated during recording setup.") } try await self.audioProcessor.configureAudioEngine() let (recognizer, request) = try await MainActor.run { () -> (SFSpeechRecognizer, SFSpeechAudioBufferRecognitionRequest) in guard let result = self.createRecognitionRequest() else { throw AppError.configurationError(description: "Speech recognition not available or SFSpeechRecognizer initialization failed.") } return result } await MainActor.run { self.recognitionRequest = request } await MainActor.run { self.recognitionTask = recognizer.recognitionTask(with: request) { [weak self] result, error in guard let self = self else { return } if let error = error { // WE ENTER INTO THIS BLOCK, ALWAYS self.logger.error("Recognition task error: \(error.localizedDescription)") self.processingError = .speechRecognitionError(description: error.localizedDescription) return } . . . } } . . . }.value } catch { . . . } } @MainActor func stopRecording() { logger.debug("SpeechToTextManager.stopRecording() called") guard isRecording else { logger.debug("Not recording, nothing to do") return } isRecording = false Task.detached { [weak self] in guard let self = self else { return } await self.audioProcessor.stopEngine() let finalBuffer = await self.audioProcessor.getAudioBuffer() await MainActor.run { self.recognitionRequest?.endAudio() self.recognitionTask?.cancel() } . . . } }
0
0
152
May ’25
Privacy - Siri Usage Description being reset to default text "Describe why your app needs Siri access" on generating archive
I have an iOS app and that has CarPlay enabled. I have Siri capability and the feature has been tested in Car. The voice commands are working perfectly fine. However, I am facing a weird issue as described below, The key NSSiriUsageDescription, is set to custom text in info.plist. After generating archive, I exported and checked the package contents, in which the the key NSSiriUsageDescription was reset to default text(Describe why your app needs Siri access) in the info.plist. I do not have any dynamic build process that's writing to the info.plist. Only the Siri key is being reset, rest of keys like camera/location permissions are intact. Kindly suggest what needs to be done at my end
0
0
136
May ’25
new rsync version not working as expected
after upgrade macos version to 15.4 the rsync start failing that cause the xcodebuild fail and not generate ipa rsync: on remote machine: --extended-attributes: unknown option rsync error: syntax or usage error (code 1) at main.c(1802) [server=3.4.1] rsync(73444): error: unexpected end of file rsync(73444): error: io_read_nonblocking rsync(73444): error: io_read_buf rsync(73444): error: io_read_int rsync(73444): warning: child 73445 exited with status 1
0
0
238
Apr ’25
Development Universal Linking
I am trying to setup a unversal linking for my new developing app. but it look like not function well. did any one have some examples or demo domains suggest to use? In fact finally my app is just internal using, user will not suppose connect to internet , how can I using the universal linking without a website ? Thanks
0
0
85
May ’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
498
Feb ’25
I have a target that dynamically generates the modulemap when new headers are added. Is there a way to specify for the target that uses that modulemap to wait for this modulemap file?
I have two targets: Library and Generate-Library-Modulemap I use a modulemap to help bridge the Objective-C++ code to Swift. Generate-Library-Modulemap is set up to run only when new headers are added (this is done reliably through some trickery). This seems to work, but the problem is that if I add Generate-Library-Modulemap as a dependency of Library, it seems that by the time Library Generate-Library-Modulemap is run, the Library target has already loaded up an outdated modulemap file. The result is my first attempt to build after adding headers is that the framework fails, as even though the modulemap was generated, it was not attached to the framework. The second attempt succeeds as it reads the updated modulemap. Is there any way to force Xcode to run the Generate-Library-Modulemap step before starting on Library? Or perhaps attach the modulemap after the fact?
0
0
76
Jun ’25
Mac (Designed for iPad) not been able to install on Mac testflight
Hi I developed an iPhone app but now I want to release the same app for iPad and Mac (Design for iPad). I made the changes below but I still not been able to install the app on my Mac. It says the app is incompatible but my Mac is MacBook Pro M2 which fills the requirements to install it. Things I did so my iPhone app could have support for iPad and Mac Added iPad and Mac (Designed for iPad) for the supported destinations Change the Status Bar Style to Require full screen Changed iOS minimum Deployments iOS to 17.6 Updated the launch screen logo so stays in the middle Xcode version 16.2 See the sccreenshots of the Xcode configuration and of the TestFlight on my MacBook Pro M2 Is there anything else I need to do? Thanks.
0
0
89
May ’25
NO_CRASH_STACK with different number of crashes from the App Store.
Hello. For the last few months I have been facing a situation for which I do not understand either the reason or the solution. Here is an example for the last few weeks: In App Store Connect it shows 214 crashes for the last week In Xcode it shows 56 crashes for the last 2 weeks without stack traces (NO_CRASH_STACK) In Firebase Crashlytics there is not a single crash. When I click "Show in Finder" it opens a folder with .xccrashpoint files. As far as I understood from the instructions on posting crash reports - this is not what is needed. Interesting point: it looks like the errors occur on iOS 15-16 devices. I have several questions: Why is the number of crashes in Xcode different from the number in App Store Connect? Where are the other crashes? How can I understand what the problem is if there are no stack traces in Xcode?
0
0
116
May ’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
237
Feb ’25
CPListTemplate in CarPlay Simulator: Multiple Items Selected on Tap
I am encountering an issue while running my CarPlay app in the simulator using CPListTemplate. On app launch, when I tap on the first item in the list and then tap on the second item, both items remain selected instead of only the latest tapped item. This behavior does not align with the expected single-item selection functionality. Has anyone else faced this issue? Is there a workaround or a known resolution for this behavior?
0
0
43
May ’25
Xcode 16 is running on an iPhone 7 with iOS 12.1.3. The application fails to open normally and crashes immediately upon startup.
I am currently using Xcode 16 (16A242d) and testing on an iPhone 7 running iOS 12.1.3. However, when I try to launch the app on the device, it crashes immediately. Below are the crash logs from the iPhone 7: 错误 11:54:55.731858+0800 kernel Sandbox: assertiond(62) System Policy: deny(1) file-read-metadata /private/var/mobile/Library/DuetExpertCenter/caches/ATXCacheFile-_ATXAppPredictor-TotalScore 错误 11:54:55.731897+0800 kernel Sandbox: assertiond(62) System Policy: deny(1) file-read-metadata /private/var/mobile/Library/DuetExpertCenter/caches 错误 11:54:55.754498+0800 kernel Sandbox: duetexpertd(132) deny(1) mach-lookup com.apple.proactive.ActionPrediction.predictions 错误 11:54:55.756102+0800 duetexpertd Unable to remove recent engagement cache file. Error: Error Domain=NSCocoaErrorDomain Code=4 UserInfo={NSFilePath=, NSUserStringVariant=, NSUnderlyingError=0x100db60a0 {Error Domain=NSPOSIXErrorDomain Code=2}} 错误 11:54:56.571640+0800 symptomsd Attempt to add an app with insufficient id, info { BKSApplicationStateAppIsFrontmost = 1; BKSApplicationStateExtensionKey = 0; SBApplicationStateDisplayIDKey = "com.igetcool.app"; SBApplicationStateKey = 8; SBApplicationStateProcessIDKey = 696; SBApplicationStateRunningReasonsKey = ( { SBApplicationStateRunningReasonAssertionIdentifierKey = UIApplicationLaunch; SBApplicationStateRunningReasonAssertionReasonKey = 10000; } ); SBMostElevatedStateForProcessID = 8; } 错误 11:54:56.829372+0800 assertiond [IGCProject:696] SyscallError: setpriority(PRIO_DARWIN_ROLE, 696, 3): No such process 错误 11:54:56.944833+0800 dasd Activity not tracked as being started, ignoring it 错误 11:55:06.153790+0800 symptomsd Attempt to add an app with insufficient id, info { BKSApplicationStateAppIsFrontmost = 1; BKSApplicationStateExtensionKey = 0; SBApplicationStateDisplayIDKey = "com.igetcool.app"; SBApplicationStateKey = 8; SBApplicationStateProcessIDKey = 697; SBMostElevatedStateForProcessID = 8; } 错误 11:55:06.430433+0800 assertiond [IGCProject:697] SyscallError: setpriority(PRIO_DARWIN_ROLE, 697, 3): No such process 错误 11:55:13.158889+0800 symptomsd Attempt to add an app with insufficient id, info { BKSApplicationStateAppIsFrontmost = 1; BKSApplicationStateExtensionKey = 0; SBApplicationStateDisplayIDKey = "com.igetcool.app"; SBApplicationStateKey = 8; SBApplicationStateProcessIDKey = 699; SBMostElevatedStateForProcessID = 8; } 错误 11:55:13.416290+0800 assertiond [IGCProject:699] SyscallError: setpriority(PRIO_DARWIN_ROLE, 699, 3): No such process I am trying to understand what is causing this issue. Even after archiving and installing the app, it still crashes. According to the official documentation, Xcode 16 is supposed to support iOS 12, but this issue persists. I would like to know the possible reasons for this behavior.
0
0
401
Mar ’25
Build input file cannot be found
Hi! When I run my project on a real device (iPhone 15 Pro), I encounter the following error: Build input file cannot be found: '/Users/Interexy/Library/Developer/Xcode/DerivedData/SinglePhotoBook-geecnphrjebsisdmhcyzlsefvphm/Build/Products/Debug-iphoneos/SinglePhotoBook.app/SinglePhotoBook'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? How can I solve this? I've already reinstalled Pods and cleaned DerivedData a million times, but the issue persists. Xcode: Version 15.4
0
0
294
Mar ’25
Xcode not omitting binary of static framework
I'm following the steps laid out in Creating a static framework which states: When a client links and embeds the framework, Xcode 15 or later omits the main binary from the embedded framework bundle because it’s already statically linked into the client. Specifically, I'm adding a new framework target to my project, and then changing the Mach-O type in its build settings to Static Library. What I'm observing when I build (debug or release) is that that the resulting framework folder inside of the app bundle still contains a binary. Furthermore, upon inspecting strings and symbols in both the main app executable and this library binary, it appears that my strings and symbols do end up in the main executable and not in the library binary. Does this mean that this binary is just a stub left behind? Is this intended? Can I safely delete this binary with a build phase script?
0
0
84
May ’25