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

Xcode Documentation

Post

Replies

Boosts

Views

Activity

Is there anyway to view output from an Xcode scheme's build pre-action / verify it completed successfully?
I've got a custom run script build phase in my Xcode iOS project, however I want it to run before the items in the Target Dependencies section get built. So I added a Pre-Actions phase to the target's build scheme and pasted the contents there. However, during a build, there's no way to see if the stuff in the pre action is successful or not. It's possible to put echo statements into a run script build phase which is useful to print values such as file paths etc. but these don't work when part of a scheme pre action. Also if I deliberately put garbage into the scheme pre action, then I can see Xcode is still running the pre action, but as its full of garbage it should fail, but Xcode doesn't report any errors anywhere. So, is there any way to see and confirm if a scheme pre-action was successful or not, or to output logging statements from it to verify values its using are as expected?
0
0
140
2w
XCUITest Screenshots not saving
I have some (very old ObjC) XCUITests, in Xcode 15.2. I recently noticed programmatic screenshots are not saving. The screenshots generated automatically by XCUITest are saving fine. This is code that used to work as expected; I do not know when it broke as I haven't had need to run this in a while. -(void)takeScreenshotWithName:(NSString *)name { XCUIScreenshot *screenshot = XCUIScreen.mainScreen.screenshot; XCTAttachment *attachment = [XCTAttachment attachmentWithScreenshot:screenshot]; attachment.lifetime = XCTAttachmentLifetimeKeepAlways; attachment.name = name; [self addAttachment:attachment]; UIImage *image = screenshot.image; UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil); } During testing I added the UIImageWriteToSavedPhotosAlbum call, to verify the code is running and the image is available - and it does. But I really don't want these images cluttering up my library. The results are the same whether I run my tests from within Xcode, or via the command line. I need these screenshots so I have a set in PNG format, with standardized naming, for archiving, searching, and comparisons. The automatic screenshots are in Xcode's format - useful when reviewing a single test, which isn't my use case here.
0
0
118
2w
Info.plist Heeeeeellllp
hello. i have 3 time started a new project now I am making a app and i get a Error code on Info.plist file. I have been trying to resolve an issue with the Info.plist file in an Xcode project. The error message is "Multiple commands produce" related to the Info.plist file. I have tried several approaches to fix the issue, including: Checking the "Copy Bundle Resources" section in the "Build Phases" tab of the project settings to ensure there is only one Info.plist file listed. Deleting the Info.plist file from the project and creating a new one, then updating the reference to the Info.plist file in the "Build Settings" tab. Can anyone help me with this??
3
0
740
May ’23
Distributing Binary via Cocoapods & Swift Packages
I maintain a library that has thus far used Cocoapods to manage dependencies and also distribute an xcframework of the library. I'd now like to also distribute the same library through Swift Packages but am running into issues. I'm using the same xcframework in a local Swift Package and have added all the necessary dependencies to Package.swift, but when I attempt to add this Swift Package to a test app, the app will build correctly but fail at runtime due to a missing .framework file for a dependency I'll just call THE_DEPENDENCY: dyld[61483]: Library not loaded: @rpath/THE_DEPENDENCY.framework/THE_DEPENDENCY Referenced from: <75074516-C1CD-3251-8807-94A7502176A7> /Users/ME/Library/Developer/Xcode/DerivedData/MY_TEST_APP-bwfsfwjjnagdurdnjrhhdppgitvr/Build/Products/Debug-appletvsimulator/MY_LIBRARY.framework/MY_LIBRARY Reason: tried: '/Users/ME/Library/Developer/Xcode/DerivedData/MY_TEST_APP-bwfsfwjjnagdurdnjrhhdppgitvr/Build/Products/Debug-appletvsimulator/THE_DEPENDENCY.framework/THE_DEPENDENCY' (no such file) Indeed, there is no THE_DEPENDENCY.framework file anywhere, it is only present in a version of the test app that uses Cocoapods. As you can see, the reference to this file arises from MY_LIBRARY, and in MY_LIBRARY.xcodeproj I can see there is a reference to THE_DEPENDENCY.framework, which appears as a consequence of running pod install. Thus, it looks to me like the .framework file appears either as part of Cocoapods dependency injection, or perhaps as a consequence of how that dependency is distributed through Cocoapods. I'm forced to install pods during my build process because, as I understand it, all dependencies must be available during the archiving process to avoid compilation errors. If the dependencies must be available during archiving, but adding the dependencies via Cocoapods creates a reference to .framework files that will not be present in a Swift Package project, what is the best practice for distributing xcframework binaries to both Cocoapods and Swift Package Manager? It looks as though I'll have to build two different xcframeworks: one built with dependencies provided via pods, and the other via swift packages. Is this correct?
0
0
131
2w
Issue with localizable.strings file not found during archiving
I'm encountering the following error while attempting to archive my app: unable to read input file: fopen({~}/Library/Developer/Xcode/DerivedData/{project name}-gxaapsrbutxnmwderhyslgnfznrl/Build/Intermediates.noindex/ArchiveIntermediates/{project name}/IntermediateBuildFilesPath/{project name}.build/Release-iphoneos/{project name}.build.lproj/Localizable.strings, rb): No such file or directory (2) (in target '{project name}' from project '{project name}') I've anonymized {project name} and {~} in the path for privacy reasons. It seems like the error pertains to not finding the localizable.strings file. Prior to encountering this error, I made the following modifications: Originally, my project used the legacy localizable.strings for localization, but I recently switched to using a string catalog. I added 8 additional languages alongside the existing Base, English, and Korean. I'm writing into the new Localizable.xcstrings file using some python scripts. When I open it in Xcode after pasting, all rows appear correctly. This error occasionally occurred even when I 'run' the app, but clearing derived data and cleaning the build folder resolved it temporarily. However this error happens always when I try to 'archieve' this. Despite copying the project due to difficulty resolving the issue within the project itself, I'm still encountering the same problem. Below are the Build Setting and Build Phases configurations: Build Phases > Compile Sources and Link Binary with Libraries do not include localizable.strings. Build Settings > Localization is set to "Yes" for all. I've tried various methods found online without success, and similar cases are scarce. Please help me resolve this issue.
1
0
166
3w
Define Custom Tests in Xcode project template
I am using a custom app project template and I would like to also include custom Test files (or implementation) when I select to add Swift Testing or XCTest. What should I add to my TemplateInfo.plist to either extend or override the default templates? This is not documented by Apple and it's hard to figure out. Thanks in advance for any help.
0
0
112
2w
Create ML "Unexpected Error" During Hand Action Classification Training
I have created a Hand Action Classification project following the guidelines which causes the Create ML tool to provide the very cryptic "Unexpected Error". The feature extraction phase is fine, with the error occurring during model training after the tool reports completion of the first five training iterations as it moves on to report the next ten. The project is small with 3 training classes and 346 items I have tried to vary the frame rate and action duration, with all augmentations unset, but the error still persists. Can you please confirm how I may get further error diagnostic information so that I can determine why Create ML is unable to work with my training data? Mac OS is Sonoma 14.5 on an iMac 24-inch, M1, 2021. Create ML is Version 5.0 (121.4)
2
0
191
3w
"Planning swift module" takes several minutes
Hi, I'm looking for help on how to troubleshoot. I will probably file a bug report, but I wonder if it's Xcode or Swift, and I would like to put some more data than I currently have. With Xcode 16 beta 2, the "planning swift module" stage of one of the modules often takes several minutes (between 280 and 300 seconds). Normally it takes a few seconds. The other modules take less than a second. I have a workspace, containing a project and 3 local swift packages. My project contains one iOS app target, 1 framework target (a dependency of the app), and several test targets. The faulty module is the app module.
0
2
105
2w
How to bring Reality Composer Pro project to Xcode?
Hi I am stuck to work with Reality Composer Pro with Xcode. When I made an anchor component for detecting surface to USDZ file and save to Reality Composer Pro project. and try to see in my iPhone. but keeps got error like follow. Building for 'iphoneos', but realitytool only supports [xros, xrsimulator] How can I correctly bring my Reality Composer Pro project to Xcode to see in my iPhone? I tried to find but can't see step by step explain. thanks
0
0
85
2w
Strange behavior of opening a new file on Xcode
I have noticed that every time I open a new file (by clicking, double-clicking, or using "open quickly"), instead of opening in a new tab, there is a chance that it will replace my current tab with the new file. For example, if I have 3 files open, my tabs look like this: [a.swift, b.swift, c.swift] and b.swift is my current working file. When I open d.swift, my tabs then become: [a.swift, d.swift, c.swift] How can I change this behavior?
0
0
42
2w
Release app to production with Xcode 16 beta and MacOS 15 beta
I've updated my mac to Sequoia (MacOS 15) beta, my iPhone to iOS 18 beta, and Xcode to Xcode 16 beta. Only then, I realized I couldn't publish app updates with Xcode beta (error in AppStore Connect). I tried using the non-beta Xcode version but got "Invalid Binary" during app review: ITMS-90111: Unsupported SDK or Xcode version - App submissions must use the latest Xcode and SDK Release Candidates (RC). For details on currently supported versions, visit: https://developer.apple.com/news/releases. I really need to publish updates and I can't wait for September. I can't downgrade my devices because that would require me to erase both my Mac and my iPhone (for testing), which is not something I can do. Is there any option I didn't think about? How can I publish app updates in the current situation? It really should be more explicit before updating that you can't release updates with the beta versions...
4
2
400
2w