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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Created

Xcode won't execute code?
Hi everyone. I have the following code that I am trying to execute in Xcode. I then install it on my iPhone. It doesn't run at all and I don't know why. Any thoughts? Thank you. import CoreMotion class MyViewController: UIViewController { let motionManager = CMMotionManager() func startAccelerometer() { if motionManager.isAccelerometerAvailable { motionManager.accelerometerUpdateInterval = 0.1 // 10 updates per second motionManager.startAccelerometerUpdates(to: .main) { (data, error) in guard let accelerometerData = data else { return } let x = accelerometerData.acceleration.x let y = accelerometerData.acceleration.y let z = accelerometerData.acceleration.z // Process the x, y, and z acceleration values here print("X: \(x), Y: \(y), Z: \(z)") } } } }
7
0
145
3w
Apple Intelligence in Xcode with models hosted in Azure AI Foundry
I have managed to configure Apple Intelligence in Xcode to access my deployed models in Azure AI Foundry. However, when I would try to chat with the selected model, I get the following error: Message from Azure OpenAI: Failed request due to: bad request Additional context: {"error": {"code": "BadRequest", "message": "Response API v1 is in GA, please use remove api-version or use api-version=latest."}} Is there a way to remove v1 from the endpoint used or to define an explicit api-version? Or do I have to change my deployment in Azure AI Foundry?
1
0
63
3w
No FCM token found
The issue I am facing is that even when I run my app from a physical device, I get the error "No FCM token found," while push notifications are enabled in my Xcode capabilities. I don't see the FCM token generated in the users' collection on Firestore. While the code setup seems good, the same error persists. I have implemented the logic to retrieve the FCM token, hat the necessary permissions are granted in my app.Here are my Firestore rules: rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { // Allow authenticated users to read and write their own user data match /users/{userId} { allow read: if request.auth != null; allow update: if request.auth != null && (request.auth.uid == userId || // Allow FCM token updates request.resource.data.diff(resource.data).affectedKeys().hasOnly(['fcmToken'])); allow create: if request.auth != null; match /followers/{followerId} { allow read: if request.auth != null; allow write: if request.auth != null && request.auth.uid == followerId; } match /following/{followingId} { allow read: if request.auth != null; allow write: if request.auth != null && request.auth.uid == userId; } match /blockedUsers/{blockedUserId} { allow read, write: if request.auth != null && request.auth.uid == userId; } } // Messages collection match /messages/{messageId} { allow create: if request.auth != null && (request.resource.data.senderId == request.auth.uid || request.resource.data.receiverId == request.auth.uid); allow read, update, delete: if request.auth != null && (resource.data.senderId == request.auth.uid || resource.data.receiverId == request.auth.uid); } // Chats collection match /chats/{chatId} { allow create: if request.auth != null && request.auth.uid in request.resource.data.participants; allow read, update, delete: if request.auth != null && request.auth.uid in resource.data.participants; } // Call-related documents match /calls/{callId} { allow create: if request.auth != null && request.auth.uid in [request.resource.data.callerId, request.resource.data.receiverId]; allow read, write: if request.auth != null && (request.auth.uid == resource.data.callerId || request.auth.uid == resource.data.receiverId); } // Posts match /posts/{postId} { allow read: if true; allow create, update: if request.auth != null; allow delete: if request.auth != null && request.auth.uid == resource.data.userId; } // Reports match /reports/{reportId} { allow create: if request.auth != null; allow read: if request.auth != null; allow update: if request.auth != null; } // ✅ New livestreams collection rule added here match /livestreams/{document} { allow read, write: if request.auth != null; } } } [my index.js](https://developer.apple.com/forums/content/attachment/bffd0276-ece5-4ce9-b08b-83e8770cb8f2) [My code of class AppDelegate](https://developer.apple.com/forums/content/attachment/abba6a58-d513-49d4-a1d4-dc7dfae56e0a) [code of class AVDelegateWrapper:](https://developer.apple.com/forums/content/attachment/acd15ac0-ba9e-415f-9503-aea88377e92f) ` [struct ContentView](https://developer.apple.com/forums/content/attachment/4f75c535-860e-488f-835b-63c76586ac50) ` [And for after Login code : ](https://developer.apple.com/forums/content/attachment/f6af060e-f2bb-417f-af08-a946dd650474) `
0
0
61
3w
Issue with creating Sticker Apps
When I create a sticker app in any version of Xcode or for any iOS version, I keep running into the following error: Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Could not find attribute name in domain plist" UserInfo={NSLocalizedFailureReason=Could not find attribute name in domain plist}> I only added stickers after creating the project and this is what happens after running it. I have cleared Derived Data, tried creating a new Info.plist, but nothing seems to solve this core issue. This also occurs both when attempting to run the project on a simulated phone and a physical device. This error also only happens when the sticker app is opened in iMessage. I have looked for solutions everywhere, but none seem to solve my problem. Am I overlooking something?
1
0
65
3w
Swift Testing Failed to complete Unit Tests -> not enough values to unpack (expected 2, got 1)
I’m migrating some XCTest cases to Swift Testing and hit a runtime error when using tuple arguments within the CI. I don't have an issue when running locally. [2025-08-21 14:22:13.493] [unit_tests] [WARNING] Could not find test status list for -[FooManagerTests testEndpoint(region:enforce:expectedEndpoint:)] [2025-08-21 14:22:18.054] [unit_tests] [ERROR] not enough values to unpack (expected 2, got 1) ##[error]Failed to complete Unit Tests -> not enough values to unpack (expected @Test("Telemetry endpoint routing", arguments: [ (TelemetryRegion.value1, false, Foo.someValue1), (TelemetryRegion.value2, false, Foo.someValue2), (TelemetryRegion.value3, true, Foo.someValue3), (TelemetryRegion.value4, false, Foo.someValue4), ]) func testEndpoint(region: enforce: expectedEndpoint: ) { ... }
0
0
64
3w
iMessage Sticker Pack Extension not appearing in iOS 18.6 Simulator (Xcode 16.4)
Hello everyone, I am currently developing an iMessage Sticker Pack in Xcode 16.4 (Build 16F6) on macOS 15.6.1. The project builds without errors, but when running in the iOS 18.6 Simulator (iPhone 15 Pro, iPhone 16, etc.), the Sticker Pack does not show up inside Messages. Instead, the Simulator displays a white screen or the sticker drawer simply does not include my extension. In the logs I consistently see this error: FrontBoard[app] error: Application "de.eazyapp.smileystickerpack.StickerPackExtension" is unknown to FrontBoard Simulator device failed to launch de.eazyapp.smileystickerpack. Domain: FBSOpenApplicationServiceErrorDomain Code: 1 Failure Reason: The request was denied by service delegate (SBMainWorkspace) for reason: NotFound ("Application "de.eazyapp.smileystickerpack" is unknown to FrontBoard"). User Info: { BSErrorCodeDescription = RequestDenied; DVTErrorCreationDateKey = "2025-08-21 10:11:22 +0000"; FBSOpenApplicationRequestID = 0x6e63; IDERunOperationFailingWorker = IDELaunchiPhoneSimulatorLauncher; SimCallingSelector = "launchApplicationWithID:options:pid:error:"; } The request to open "de.eazyapp.smileystickerpack" failed. Domain: FBSOpenApplicationServiceErrorDomain Code: 1 Failure Reason: The request was denied by service delegate (SBMainWorkspace) for reason: NotFound ("Application "de.eazyapp.smileystickerpack" is unknown to FrontBoard"). User Info: { BSErrorCodeDescription = RequestDenied; FBSOpenApplicationRequestID = 0x6e63; } The operation couldn’t be completed. Application "de.eazyapp.smileystickerpack" is unknown to FrontBoard. Domain: FBSOpenApplicationErrorDomain Code: 4 Failure Reason: Application "de.eazyapp.smileystickerpack" is unknown to FrontBoard. User Info: { BSErrorCodeDescription = NotFound; } Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : { "device_identifier" = "A3986FB9-55ED-42CC-9336-F695C4CB9451"; "device_model" = "iPhone17,1"; "device_osBuild" = "18.6 (22G86)"; "device_platform" = "com.apple.platform.iphonesimulator"; "device_thinningType" = "iPhone17,1"; "dvt_coredevice_version" = "443.24"; "dvt_coresimulator_version" = "1010.15"; "dvt_mobiledevice_version" = "1784.140.4"; "launchSession_schemeCommand" = Run; "launchSession_state" = 1; "launchSession_targetArch" = arm64; "operation_duration_ms" = 23478; "operation_errorCode" = 1; "operation_errorDomain" = FBSOpenApplicationServiceErrorDomain; "operation_errorWorker" = IDELaunchiPhoneSimulatorLauncher; "operation_name" = IDERunOperationWorkerGroup; "param_debugger_attachToExtensions" = 0; "param_debugger_attachToXPC" = 1; "param_debugger_type" = 3; "param_destination_isProxy" = 0; "param_destination_platform" = "com.apple.platform.iphonesimulator"; "param_diag_113575882_enable" = 0; "param_diag_MainThreadChecker_stopOnIssue" = 0; "param_diag_MallocStackLogging_enableDuringAttach" = 0; "param_diag_MallocStackLogging_enableForXPC" = 1; "param_diag_allowLocationSimulation" = 1; "param_diag_checker_tpc_enable" = 1; "param_diag_gpu_frameCapture_enable" = 0; "param_diag_gpu_shaderValidation_enable" = 0; "param_diag_gpu_validation_enable" = 0; "param_diag_guardMalloc_enable" = 0; "param_diag_memoryGraphOnResourceException" = 0; "param_diag_mtc_enable" = 1; "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_enable" = 0; "param_diag_sanitizer_ubsan_stopOnIssue" = 0; "param_diag_showNonLocalizedStrings" = 0; "param_diag_viewDebugging_enabled" = 1; "param_diag_viewDebugging_insertDylibOnLaunch" = 1; "param_install_style" = 2; "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.messages"; "param_structuredConsoleMode" = 1; "param_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "iphonesimulator18.5"; "sdk_osVersion" = "18.5"; "sdk_variant" = iphonesimulator; } System Information macOS Version 15.6.1 (Build 24G90) Xcode 16.4 (23792) (Build 16F6) Timestamp: 2025-08-21T12:11:22+02:00 Steps I already tried: Verified Bundle Identifiers (App + Extension) Confirmed Stickers.xcstickers is only in the Extension target, not the App target Checked that the Extension is properly listed under Embed Foundation Extensions Performed Clean Build Folder, Simulator reset, and reinstall Tried on a fresh Mac with clean Xcode install Reproduced consistently across multiple iOS 18 Simulators Steps to reproduce Create new iMessage Sticker Pack App in Xcode Add PNG/APNG stickers into Stickers.xcstickers Run on Simulator (iOS 18.6) Open Messages → App Drawer Sticker Pack is missing, extension does not load Environment Xcode 16.4 (16F6) macOS 15.6.1 (24G90) iOS Simulator 18.6 Project type: iMessage Sticker Pack Question Has anyone else experienced this issue with iMessage Sticker Packs on iOS 18 Simulators? Any guidance would be appreciated Thank you, Hakan
1
0
75
3w
App Attest Error
Hi, I'm running into an issue with App Attest in my iOS app, and I'm hoping you can help me troubleshoot. I've registered my app in App Check for both App Attest and Device Check, and I've double-checked that my bundle ID is correct. I've also enabled App Attest in Xcode capabilities and am testing on a physical device. However, when I run the app, I'm getting the following error in the console: Error getting App Check token; using placeholder token instead. Error: App attestation failed. HTTP status code: 403 "message": "App attestation failed." I've tried a few things, but I'm still stuck. Any suggestions on what might be causing this or how to resolve it would be greatly appreciated! Thanks in advance
1
0
53
3w
Live activity push update is not work
Hey there, i start a live activity with notification , and but sometime it can not update, it happens sometime and make me so confuse; like about 2025-08-19 +8.0 09:20:52 updatetoken : 40ead3fd4dd4a934548c5455c645fc6920edfaa0ddad98abd619dc1d2662389c15d3dc3b420bdec733d9438d25ae61cb55601ae64292b3064a71ffb8d0355633f3f0f2254e6f7438282ce83366d8430c app can not accept push update msg, and APNs has show success when server send update msg to APP; how can i check the APNS to APP? Thanks
2
0
83
3w
App name not localized
Now using Xcode 26 beta 6, and iOS/iPadOS 26 beta 7 - and I found the codes do not compiled with localized name. Since I have been buidling the codes since beta 1, the app might have localized name in the past. Even Localizable file is there with proper translation. I have however, started to build icon using Icon Composer (before that was not). I have also tried to add in CFBundleDisplayName and CFBundleName in Localizable file, and same (English is shown). What have I done wrong or forget to do?
1
0
57
3w
SwiftSupport is missing
I'm trying to distribute an app for internal testing but I'm always getting the below error and the SwiftSupport folder is not created although I tried different fixes/configurations. How can I debug/see the reason why the SwiftSupport folder is not generated? Xcode 16.4 Build version 16F6 I tried distributing from the Transporter, Xcode organizer, I tried to archive it both from Xcode and from the command line. There are a couple of answers on StackOverflow, nothing helped. What could be the problem? One of the things I tried: xcodebuild \ -project PhotoBook.xcodeproj \ -scheme PhotoBook \ -configuration Release \ -archivePath Release/PhotoBook.xcarchive \ -destination 'generic/platform=iOS' \ -verbose \ archive xcodebuild \ -exportArchive \ -archivePath Release/PhotoBook.xcarchive \ -exportPath Release \ -exportOptionsPlist ExportOptions.plist \ -destination 'generic/platform=iOS' \ -verbose ExportOptions.plist <?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>method</key> <string>app-store-connect</string> <key>teamID</key> <string>T672CQXP54</string> <key>uploadSymbols</key> <true/> <key>uploadBitcode</key> <false/> <key>signingStyle</key> <string>manual</string> <key>provisioningProfiles</key> <dict> <key>com.mandelbrotsc.PhotoBook</key> <string>iOS Distribution Profile</string> </dict> </dict> </plist> The error: ITMS-90426: Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.
0
0
31
3w
Redefinition of module 'AppleTextureEncoder'
I have been working on a project before this year's new OSX and Xcode update and I was able to build the project with little trouble. But since updating to any of the beta software, including the latest version of Tahoe 26.0 and Xcode26-beta4 I have not been able to build this same project. I have tried reseting package cache and updating to the latest package versions. As well I have deleted the derived data and cleaning the build folder. The following error output is one of 55 errors I am getting. It seems like the modules for the XRSimulator are redefinitions from those for MacOSX. I don't know how to limit or redirect the definition of the modules to just those for the XRSimulator (this is a VisionOS project). I also tried all of this on different betas of Xcode with all the same result. This bug is causing a problem with the 16.4 version of Xcode as well. I would really really appreciate anybody's help on this. in file included from /Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator26.0.sdk/usr/include/module.modulemap:2: Previously defined here : CommandLineTools/SDKs/MacOSX26.0.sdk/usr/include/AppleTextureEncoder.modulemap
2
0
108
4w
iPhone app Liquid Glass icon on iPad not respecting icon display mode
Hi, I'm updating my iPhone app (iPhone only) to be ready with iOS 26. I'm building my app using Xcode 26.0 beta 6 (17A5305f) and testing it on an iPad running iPadOS 26 (23A5326a). I found an issue with my new app icon updated using Icon Composer and I was able to find the issue. An iPhone only app running on iPadOS 26 doesn't use the provided app icon. It always displays the "standard" light icon. I just added iPad in Supported Destinations and the app icon now respect light/dark/translucent/tinted modes on the Home Screen. I submitted feedback FB19768667
1
0
141
4w
ViewModel Scene's not rendering properly
Hi All, I'm new to IOS development/Xcode and would appreciate any/all advice/guidance on this unexplainable issue. Please excuse my potential usage of wrong terms. I have a project that was handed to me in a near completed state and there is a UI bug in the program that I am trying to fix. It is opening multiple instances of a View Controller Scene in the wrong dimensions, causing instanced layers that act independently of each other rather than a simple "page re-routing" like regular front end development. Upon investigating the codebase I have noticed the following potential source: The storyboard was originally modeled after an IPhone 16 Pro Max, however the main device we will be creating the app for is an iPad 11 mini. Upon changing the simulated device, the view models for most of my XXXViewControllerScenes are not rendering the correct size. Here are some examples: Image1 ) When selecting the RootNavController (scene 1) > all storyboard scenes render the correct size (at least thats what it visually looks like). When clicking on the "Type Select View Controller" or the View within the "Type Select View Controller Scene" (scene 2) the view models remain the correct size. Image2) However when clicking into the View for "Order Start View Controller Scene" - this causes the View and SafeArea renders for all scenes(except the RootNav)to shrink and not be the correct size equal to the simulated device: This also persists, where previosly my Scene 2 which was the correct size, is now the incorrect size no matter what I do. The only way I have found to work around this is to re-select my RootNavController to render all scenes the proper size, then individually click the components I'm trying to edit in the Document Outline panel and tweak them manually on the Attribute Editor. Not to mention this makes setting constraints extremely hard as the elements render "off screen" What I have checked so far: Ensure all my ViewControllerScene's Attribute Editor > Simulated Metric > Size = Inferred Unchecked "Use Preferred Explicit Size" for all ViewControllerScene's Attribute Editor > Simulated Metric > Content Size - 1 thing to note here is some of them have a set size of 744x1133 (when they render the full size) but it changes to 580x640 (when it shrinks) even though the option is UNCHECKED? Circling back to the UI Bug in my app, when I segue to the next Scene, the pages end up loading in the shrinked dimension. Please help me identify what is causing this issue and how to fix it or refer me to some guides that can assist.
1
0
104
Aug ’25
Xcode certificates
Hi there, can anyone help here. I think somewhere along the way I ***** certificates or don't have the right one, anyway long story short when building product I get this error: Embedded binary is not signed with the same certificate as the parent app. Verify the embedded binary target's code sign settings match the parent app's.
1
0
102
Aug ’25
iOS 26 CarPlay Widgets
My company's app has a few widgets and a couple of them we do not want to show up on CarPlay due to safety concerns when iOS 26 releases. I understand Apple's recommended way to prevent users from using your widget in CarPlay is to use the .disfavoredLocations([.carPlay], for: [.systemSmall]), and this puts your widget in the 'Other' section of the widgets. https://developer.apple.com/download/files/CarPlay-Developer-Guide.pdf However, this .carPlay widget location is only available in Xcode 26, and our app cannot be built on Xcode 26 yet due to some build errors. We are able to fix those build errors in a separate branch, but we won't be doing our official release builds on Xcode 26 until it is out of beta, which is usually right before iOS 26 officially releases to general audiences. We release our app versions on a monthly cadence, so the version that will be out when iOS 26 comes out is already in testing. Is there any existing way we can disable this widget on CarPlay so it does not appear to work when tapped? Currently, it opens our CarPlay app, but the CarPlay app does nothing with it. On the iPhone, when you tap the widget it opens our app and performs a function. We don't wan't to disable it on the iPhone, just when it's on CarPlay. We don't have time before the app release to implement the same functionality on our CarPlay app. I haven't found any reliable way to detect if the widget is running in the CarPlay location versus the iPhone home screen. Thanks in advance for any assistance.
0
13
211
Aug ’25
Custom file types in Buildable Folder
I am trying to solve an issue when converting an existing project to use Buildable Folders: Our current project have some custom file types that have specialized build rules, as described here: https://developer.apple.com/documentation/xcode/creating-build-rules-for-custom-file-types We previously added each of these file types, to the target's Compile Sources phase and everything was running well. Now we wish to move these files into a Buildable Folder, but I cannot find a way to make it work ... as only files with a specific file extensions are ever built in a Buildable Folder, and despite having a custom rule for this file type, it seems like Xcode never runs the rule. Is there some way to tell Xcode to treat specific extensions in a Buildable Folder as source extension?
2
0
62
Aug ’25
Xcode 26 Beta 5 HealthKit DLYD Symbol Crash
I'm having a problem with Xcode 26 where a symbol bug is causing my app to crash at launch if they are running iOS 17.X This has to do with a HealthKit API that was introduced in iOS 18.1 HKQuantityType(.appleSleepingBreathingDisturbances), I use availability clauses to ensure I only support it in that version. This all worked fine with Xcode 16.4 but breaks in Xcode 26. This means ALL my users running iOS 17 will get at launch crashes if this isn't resolved in the Xcode GM seed. I'll post the code here in case I'm doing anything wrong. This, the HealthKit capability, the "HealthKit Privacy - Health Share Usage Description" and "Privacy - Health Update Usage Description", and device/simulator on iOS 17.X are all you need to reproduce the issue. I've made a feedback too as I'm 95% sure it's a bug: FB19727966 import SwiftUI import HealthKit struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() .task { print(await requestPermission()) } } } #Preview { ContentView() } func requestPermission() async -> Bool { if #available(iOS 18.0, *) { let healthTypes = [HKQuantityType(.appleSleepingBreathingDisturbances)] var readTypes = healthTypes.map({$0}) let write: Set<HKSampleType> = [] let res: ()? = try? await HKHealthStore().requestAuthorization(toShare: write, read: Set(readTypes)) guard res != nil else { print("requestPermission returned nil") return false } return true } else { return false} }
1
0
87
Aug ’25