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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

Xcode Static Analysis Not Warning About Localization Issue - User Facing Strings when Format String is Used
If I do this: NSString *name = @"Jim"; NSMenuItem *menuItem = [[NSMenuItem alloc]init]; // Analyze does show localization warning when format string is used. menuItem.title = [NSString stringWithFormat:@"Hello %@",name]; I expect to get the following warning: User-facing text should use localized string macro But I don't. However if I do this: menuItem.title = @"What"; I do get the warning about localization as expected and as desired when I run Analyze. Is this considered a bug? Thanks!
0
0
17
9h
How can you communicate that a .xcframework is a dependency OF the swift package inside Swift package definition?
I am sort of trying to do the opposite of what others are doing. I have a target called CopyFramework that creates a CopyFramework.framework within my main xcproj file. I set up this target because a specific framework (we can call it Tools.xcframework) is distributed as a binary. That framework file lives within the code. Tools.xcframework is structured like so Tools.xcframework (Coding/testBuild/DynamicToolFrameworks/Tools.xcframework) info.plist ios-arm64/ Tools.xcframework/ Tools (executable file) Tools.bundle Headers/ Info.plist Modules/ Tools.swiftmodule/ arm64-apple-ios.abi.json arm64-apple-ios.private.swiftinterface arm64-apple-ios.swiftdoc arm64-apple-ios.swiftinterface module.modulemap module.private.modulemap PrivateHeaders/ ios-arm64_x86_64-simulator/ When the CopyFramework target is run xcode does a few steps which copy the correct version of this framework to derived data. Process Tools.xcframework (iOS) Coding/testBuild/DynamicToolFrameworks/Tools.xcframework /Library/Developer/Xcode/DerivedData/testBuild-sha/Build/Products/Debug-iphoneos/Tools.framework ios cd /Users/calebkierum/Coding/testBuild builtin-process-xcframework --xcframework Coding/testBuild/DynamicToolFrameworks/Tools.xcframework --platform ios --target-path Library/Developer/Xcode/DerivedData/testBuild-sha/Build/Products/Debug-iphoneos Meaning essentially that the Tools.xcframework for the proper platform is taken from Tools.xcframework/ios-arm64 and copied to Library/Developer/Xcode/DerivedData/testBuild-sha/Build/Products/Debug-iphoneos/Tools.xcframework I am writing a Swift Package that needs to be able to reference the correct Tools.xcframework. I have set it up like so: let package = Package( name: "CoreObjC", platforms: [.iOS(.v17), .macCatalyst(.v17)], products: [ .library(name: "CoreObjC", targets: ["CoreObjC"]), ], dependencies: [ // Does something to here ??? //.package(path: "../testBuild") ], targets: [ .target( name: "CoreObjC", dependencies: [ // Here I would like to be referencing the CopyFramework.framework target within my buildTest.xcproj file .product(name: "CopyFramework", package: /*??? its not in a swift package its a part of an xcproj file*/) ], path: "CoreObjC", publicHeadersPath: "Headers", linkerSettings: [ .linkedFramework("Tools", .when(platforms: [.iOS])), .linkedLibrary("c++") ] ), ], cxxLanguageStandard: CXXLanguageStandard.gnucxx14 ) Now obviously this does not work. I do not know how to communicate to the Package.swift file that the binary dependency is a framework target within my xcproj file. If I do run the target CopyFramework followed by building CoreObjC it works though (so long as you comment out the bits trying to reference CopyFramework). Running the CopyFramework target processes the Tools.xcframework and copies the proper xcframework sub folder to Derived data and the Swift Package build system seems to be able to see it. Is there a way I can get rid of this manual step? Make it so that when I build the CoreObjC target (swift package) that either CopyFramework is run or some other process is run to get the proper xcframework out of Coding/testBuild/DynamicToolFrameworks/Tools.xcframework and into DerivedData? Is it even theoretically possible to have a Swift Package reference a target in a normal xcproj file?
0
0
13
9h
How do I stop a Playground in Xcode 26 from constantly executing as I type
I am experimenting with Foundation Models using the new #Playground macro. It is pretty useful. One thing I am finding though, is that the playground constantly executing is distracting, when I restructure my code and know that the intermediate results are broken and I don’t care about them. I would like to disable the Playground, make some bigger code changes, and then enable Plaground again. How do I enable and disable the Playground from constantly running?
0
0
22
22h
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
23
1d
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
19
1d
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
14
18
934
1d
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
15
1d
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
27
2d
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
0
0
39
2d
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
40
2d
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
24
2d
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
18
2d
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
31
2d
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
22
2d