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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

Is a modulemap file required when importing a static library objective-c framework? If not when is a modulemap required?
I am a bit confused. My understanding previously was that a modulemap was required in order to have a bridging header be generated. Now it has come to my attention that a modulemap is both a build input and something you can put in the Modules folder of the built product if you so choose. I have tried reading the clang modulemap documentation, but am really struggling to connect most of what it says to the problem at hand. In a project I am working on, the generation of the modulemap file is quite problematic. The framework imports C++ libraries and itself writes Objective-C++ wrappers for them. Currently, the modulemap file is both set as the Module Map File in "Build Settings" and presumably used when the Swift project later imports it. In this project the modulemap is a list of the objective-c++ header files then export * I am trying to understand what I would lose if I do one or both of two things: What happens if I dont set this module map file in the build settings for the objective-c++ framework? What happens if I dont have a modulemap involved whatsoever in this objective-c++ framework and then it is imported into Swift? And does any of this change if its compiled as a static vs dynamic library? What if I embed it vs not embed it? Because the build in the real project is so complicated its hard to isolate what is going on. So I built a smaller sample app. There is CFramework which has an objective-c++ class. There is SwiftProject which imports that framework and is purely Swift. It imports the module and uses it. I did not write a modulemap file, and the Swift project builds just fine. In the timeline it: Prepares packages Computes target dependency graph Builds static cache for iPhoneSimulator18.2sdk As near as I can tell even though the objective-c++ framework is not built with a modulemap in its build settings and there is not a modulemap included in the framework everything works. So then the modulemap file is useless? Perhaps it speeds things up but what step would theoretically be skippable?
0
0
35
2w
Authentication in UI tests
Hello! I am writing UI tests for an app with OAuth authentication and want to avoid the login screen. I want each developer to store the password and username locally on their machines. The bash script will get the token. I need to access that token from my test target somehow. The idea was to write them to a temporary file that git ignores and access this file from the bundle. But I can't add the file from the build script to the target and make it accessible from the code.
0
0
36
2w
Can't download Predictive Code Completion Model
The Foundation Models Framework stopped working after Xcode failed to download the "Predictive Code Completion Model". What happened was on macOS Tahoe 26.0: Downloaded and installed Xcode 26 Beta (17A5241e) Worked with Foundation Models framework. Everything worked fine. ✅ Opened Xcode 16.4 This triggers the downloading of Predictive Code Completion Model which then fails. Go back into Xcode 26 Beta, Foundation Models framework no longer works. ❌ Error: "Failed to find asset: com.apple.gm.safety_deny.input.code_intelligence.base.generic - no asset" What I've tried or checked: Reinstalling Xcode 26 Beta Uninstalling both Xcodes and only installing Xcode 26 Beta Checked available space on drive (over 300 GB free) Restarted Mac Restarted Xcode 26 Changed wifi networks Turned on VPN Deleted the Library > Developer > Xcode folder and reinstalled Xcode 26 Feedback Report FB18208139: Can't download Predictive Code Completion Model - Xcode 26 Screenshots
18
19
1.3k
2w
IconComposer alternative app icons not working
I migrated all our alternative app icons to IconComposer icon files in my Xcode 26 project, but calling setAlternativeIconName fails with an error. Also, supportsAlternativeIcons returns false. This seems like a regression from Xcode 16. Do I need to add the CFBundleAlternateIcons? It's not needed as of Xcode 13 though.
0
0
36
2w
Module not found when using inheritance
PLATFORM AND VERSION Development environment: Xcode 16.4 (16F6), macOS 15.5 (24F74) Run-time configuration: iOS 18.3.1 DESCRIPTION OF PROBLEM I cannot build my app due to a module not found error when I'm importing Sample-Swift.h header to an ObjectiveC file. I need to use Swift code to ObjectiveC file with Swift code using an external XCFramework. It seems to be related to a mix with ObjectiveC and Swift code when Swift code uses class inheritance from FZWorkoutKit class. With a full Swift project, no issue. STEPS TO REPRODUCE Project https://fizzup.s3.amazonaws.com/files/public/Sample-WK.zip Open the provided project and try to build it. The issue occurs. In MyObject.m file, if you comment the first import (Sample-Swift.h), no issue occurs but I cannot use my Swift code (MyFile class). Uncomment the line commented in step 1. Go to MyFile.swift and change class inheritance from GoModeController (from FZWorkoutKit framework) to UIView (from UIKit). No issue occurs.
0
0
43
2w
Xcode26 beta error: “No such module '_MediaPlayer_AppIntents’”
When I import both AppIntents and MediaPlayer in the same file, I get the error “No such module '_MediaPlayer_AppIntents’” To reproduce: Create a new project with Xcode 26 beta, selecting storyboard UI and swift language. In ViewController.swift add import AppIntents and import MediaPlayer Build Get the error: “No such module '_MediaPlayer_AppIntents’” Submitted as FB18189693
1
0
69
2w
cannot find DeveloperDiskImage.dmg on iphone 18.5
Hi, I've an old mac book with old Xcode and my iphone is new 16 pro with 18.5. I've connected my iphone to my brother new mac book to copy his Xcode files from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/18.5 (22F76)" that I'll be able to debug my application on my old Mac book. I succeeded to download Symbols folder and Info.plist. however there are missing DeveloperDiskImage.dmg and DeveloperDiskImage.dmg.signature files. Couldn't find them on my brothers machine. Someone can help me understand why I cannot find them or provide the needed files for me to able to debug using my iphone? Best regards and thanks in advance, Chen
3
0
55
2w
How can you have a framework which uses a 3rd party dependency and an app that uses the framework and also the same dependency?
Is this setup possible / have a solution: There is a .xcframework F, which uses a 3rd party library, lets call it L. There is an app which uses the xcframework The app also uses L Both the app and F use SPM to integrate L F is using L for its own internal purposes. F is providing some functionality to the app. How it implements that ideally should be a black box from the app's perspective. The app also happens to use L for its own purposes. I can't get this set up working, always get warnings about duplicate symbols when running the App. This will presumably be due to the fact there are separate copies of L in both F and A. So how can that be eliminated? Can F not statically like to L and use the App's version of L at runtime? If so how can Xcode be configured so that F can actually compile? Or vice versa - can the App not statically link in its own copy of L and use that in the framework? If so, similar questions, how to configure Xcode to set this up? I can't believe this is an obscure use case, yet after days of searching and reading documentation I can't find any solution. Note that I was able to get this going when the app and the framework used Cocoapods to integrate L, but I just can't do similarly if the use of Cocoapods is replaced with SMP. When using cocoapods, within the frameworks Xcode section, the pods framework is set to Do Not Embed. This is probably the vital difference between the working Cocoapods implementation and the not working SPM solution. However, when using SPM Xcode doesn't present any option to either embed nor not embed the dependency. Why not? Can it somehow be set to not embed?
0
0
35
2w
Modifer .classEffect()
Hi everyone, does anyone also have the problem that e.g. the modifier .classEffect() does not work? it is not recognized, although I have the required versions and languages all up to date. I can't get any further, even ChatGPT was at the end of its wisdom 😬. maybe someone has the same problem and a solution for it. many thanks in advance
0
0
19
2w
Is there a way to avoid generating InfoPlist.xcstrings for framework targets?
Xcode automatically generates an InfoPlist.xcstrings file for all targets, even framework targets. In frameworks, this doesn't include any user-facing content - it only has the bundle name and the copyright string. But neither of these are going to be used by users. Is there a way to tell Xcode that it doesn't need to generate these xcstrings files for content that is not user-facing?
2
0
39
2w
dSYMs not generating in Release Build
I have a similar but different problem to another thread. I am using Xcode 16, implementing Firebase Crashlytics. I have the dSYMs working correctly in a Debug build. However when I change to a Release Build the dSYMs do not generate properly. In my archive the XXXapp.debug.dylib file is missing. I verified the debug format with dSYMs, changed Strip settings, compared Debug and Release settings etc without any fix. Any ideas of how to solve this problem?
2
0
28
2w
Is it possible to embed dependencies within a .xcframework?
I'm creating a .xcframework in order to deliver an api/functionality to a customer for inclusion into an app. I'm doing it as a .xcframework as I want it to be a binary so that the source code isn't accessable. The xcframework has dependencies on modules which are installed via SPM (there are a few, an example is PhoneNumberKit) When I build the xcframework and then add it to a test program and invoke its api then there's a run time error saying "PhoneNumberKit/resource_bundle_accessor.swift:44: Fatal error: unable to find bundle named PhoneNumberKit_PhoneNumberKit" How can I build the xcframework so that its dependencies are included within it? (Stepping back a bit, is an xcframework an appropriate approach for this?)
1
0
40
2w
CommandLineTools SDK error: conflicting types for 'MPG_PAYLOAD
building gcc14-libgcc14 using Macports + Apple clang returns following error In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/mach/message.h:78, from /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/mach/arm/thread_status.h:40, from /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/mach/machine/thread_status.h:35, from /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/mach-o/loader.h:52, from /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/mach-o/dyld.h:30, from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc14/libgcc14/work/gcc-14.2.0/libgcc/config/darwin-crt-tm.c:29: /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/mach/port.h:510:1: error: conflicting types for 'MPG_PAYLOAD'; have 'uint64_t(uint8_t, uint32_t, uint32_t)' {aka 'long long unsigned int(unsigned char, unsigned int, unsigned int)'} 510 | MPG_PAYLOAD(uint8_t flag, uint32_t a, uint32_t b) | ^~~~~~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/mach/port.h:498:1: note: previous definition of 'MPG_PAYLOAD' with type 'uint64_t(uint8_t, uint32_t)' {aka 'long long unsigned int(unsigned char, unsigned int)'} 498 | MPG_PAYLOAD(uint8_t flag, uint32_t a) | ^~~~~~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/mach/port.h:523:1: error: conflicting types for 'MPG_PAYLOAD'; have 'uint64_t(uint8_t, uint32_t, uint16_t, uint16_t)' {aka 'long long unsigned int(unsigned char, unsigned int, short unsigned int, short unsigned int)'} 523 | MPG_PAYLOAD(uint8_t flag, uint32_t a, uint16_t b, uint16_t c) | ^~~~~~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/mach/port.h:498:1: note: previous definition of 'MPG_PAYLOAD' with type 'uint64_t(uint8_t, uint32_t)' {aka 'long long unsigned int(unsigned char, unsigned int)'} 498 | MPG_PAYLOAD(uint8_t flag, uint32_t a) libgcxx compiles fine if forcing compile using clang20/clang19 there is no error.
2
1
59
2w
Auto-Link Behavior Problem
Hi, I encountered an issue in my code where I directly used #import <CoreHaptics/CoreHaptics.h> without adding it to the "Link Binary With Libraries" section under Build Phases. My deployment target is iOS 12, and the code was running fine before; however, after upgrading Xcode, the app crashes immediately on an iOS 12 device with the following error message: DYLD, Library not loaded: /System/Library/Frameworks/CoreHaptics.framework/CoreHaptics | xx | Reason: image not found. Did Xcode modify the default auto-linking configuration? When did this behavior change in which version of Xcode? Do I need to specify CoreHaptics.framework as Optional in "Link Binary With Libraries"? Thanks for reply soon!
1
0
31
2w
Documentation for SYSTEM_VERSION_COMPAT
Is there some official documentation about the SYSTEM_VERSION_COMPAT environment variable and how it affects the version reported by tools like sw_vers and whether the presence of that environment variable affects APIs like NSOperatingSystemVersion? I ask this in context of recent macOS 26 Beta version where NSOperatingSystemVersion from older versions of XCode (for example XCode 15.4) report the macOS version as 16.0.
0
0
28
2w
Xcode's Intelligence
In the latest Xcode video, I saw that the newest version of Xcode has integrated large language models (LLMs), allowing users to switch between models in Settings. However, after downloading Xcode 26 Beta and opening Settings, I couldn't find this feature. Is it because this functionality hasn't been rolled out in the Beta version?
2
0
67
2w