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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

How to Handle Identically Named Files in Different Folders in Xcode 16
Hello everyone =) I'm working at the moment on a project in Xcode 16 where I need to have multiple files with the exact same name, stored in different folders (for example, separate quest data files). When I compile, Xcode seems to treat these identically named files as duplicates, causing build errors. How can I properly organize (or configure) Xcode so that it recognizes these files as distinct? Any advice or best practices would be greatly appreciated. Thank you! ;)
0
0
244
Dec ’24
cannot find text1 in scope
import SwiftUI struct viewdetail: View { @State var text1:String = "" @State var tip1:String = "" @State var text23:String = "" @State var tip23:String = "" var body: some View { Text(text1);Text(tip1);Text(text23);Text(tip23) } } func detailLine(costa:inout [Double],tipa:inout [Double]) { print(costa,tipa) text1 = "125" cannot find 'text1' in scope print("detail") } func delete(costa:inout [Double],tipa:inout [Double],number: inout Int) { print(costa,tipa) tipa.removeLast() costa.removeLast() number -= 1 print(costa,tipa) } #Preview { viewdetail() } Does anyone know why I'm getting "cannot find text1 in scope"?
7
0
334
Dec ’24
Xcode crash always
maxOS Sequoia 15.2 Xcode 16.2 After device migration,When I create a new project or open an existing project, Xcode crashes. I have updated macOS and xcode to the latest version, and xcode has been reinstalled multiple times, but the problem still persists help me !!!
1
1
262
Dec ’24
Build input file cannot be found
I have a project that imports SPM swift-navigation which in-turn imports SPM https://github.com/pointfreeco/swift-perception I have a test target it builds and runs with no issues in XCode however if I run with xcodebuild i get the below error (I have done basics removed derived data etc.) ❌ error: Build input file cannot be found: '/Users/chris/mtp-iOS-retail-iPhone/build/Build/Products/Debug/PerceptionMacros'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'Perception' from project 'swift-perception')
0
0
397
Dec ’24
VPN causes developer cert in keychain to become untrusted
After not happening to me for a few months, this issue has started hitting me again with currently %100 reproducability. If turn on VPN on my Mac then instantly the developer certificates within the keychain become untrusted. But that's not all, if VPN is then turned off the certificates do not revert to their trusted status but remain untrusted. The consequence of this is that if VPN is turned on and then a build is perform, it fails, and the only way to fix things is to delete the cert(s) from they keychain and re-install them. As a remote worker, having this happen several or even dozens of times a day is incredibly annoying and frustrating. This issue has been occurring for literally years, sometimes it occurs very often, others while its quiet for a while, and has spanned multiple versions of Xcode and Mac OS. So whatever the cause is its endemic. It doesn't just affect myself, but all the members in my development team. I'm currently using Xcode 14.1 RC 2 and Monterey but I've seen this issue occur with many versions of Xcode and Mac. (I'm using Cisco AnyConnect Secure Mobility Client). If the VPN is somehow interfering/affecting the connectivity aspect when an attempt is made by Xcode to validate the certificate, then why does it not rectify itself after turning off VPN? This is so so so so annoying. Can somebody please comment on why this happens and if there's a way to prevent it.
5
1
3.3k
Dec ’24
"Trouble connecting consumable In-App Purchases (IAP) to App Store Connect"
I am developing an app with support for In-App Purchases (IAP) for consumable products using StoreKit. I have defined the products in ProductList.plist and Product.storekit, but I am unable to connect them correctly to App Store Connect. Here are the details: Products defined in ProductList.plist: Bolet Evento Vip: com.cover.boleto.vip Boleto Evento Básico: com.cover.boleto.basico Configuration in Product.storekit: The products have prices and basic configurations, but they do not seem to link properly in App Store Connect. Steps I have taken: Configured IAP simulation in Xcode. Attempted to register the products in App Store Connect. Issues I am facing: The products are not appearing in App Store Connect after configuration. My app cannot seem to fetch consumable products from App Store Connect. Question: What steps should I follow to correctly register consumable products in App Store Connect and connect the app with StoreKit for production? Any advice or guidance would be greatly appreciated. Thank you!
0
1
360
Dec ’24
Unable to reset simulators
I'm unable to reset simulators using the menu or the xcrun simctl tool: <output of xcrun simctl list> == Devices == -- iOS 17.5 -- iPhone SE (3rd generation) (5A06623A-173D-4C96-8DD3-3E9FE39A06F1) (Shutdown) iPhone 15 (iOS 17.5) (F4329E8D-29BB-4EA7-8465-C11A98D04ED7) (Shutdown) -- iOS 18.0 -- iPhone SE (3rd generation) (2DDE8F03-F8E1-4C1B-8E28-CD9B208F3FFA) (Shutdown) iPhone 16 Pro (DE788688-8AC6-40A0-B25C-A56AA423798E) (Shutdown) iPhone 16 Pro Max (1405184C-36A9-40F3-B0D0-4EEB88452883) (Shutdown) iPhone 16 (0CBBA7DB-B20E-4F17-BBC5-910F1F6E1A0A) (Shutdown) iPhone 16 Plus (95421C27-11A0-4FCF-A889-DAAE8557B271) (Shutdown) == Device Pairs == ~/Library`` ❯ xcrun simctl erase 0CBBA7DB-B20E-4F17-BBC5-910F1F6E1A0A An error was encountered processing the command (domain=NSCocoaErrorDomain, code=513): “data” couldn’t be moved because you don’t have permission to access “Deleting-8FEDFF47-5B2F-4534-BCA2-036BBE68CE37”. You don’t have permission. To view or change permissions, select the item in the Finder and choose File > Get Info. Underlying error (domain=NSPOSIXErrorDomain, code=1): The operation couldn’t be completed. Operation not permitted Operation not permitted Xcode Version 16.0 (16A242d) MacOS 15.0.1 (24A348)
3
3
1.7k
Jan ’25
Xcode 15.3 Command Line Build of Aggregate Doesn't Respect Derived Data Location
I have an aggregate project that compiles several Xcode projects. All Derived Data locations are set to the default: Xcode > Settings > Locations > Advanced = Unique (the default) Aggregate Project > File > Project Settings... > Derived Data = Default Location Individual Sub Projects > File > Project Settings... > Derived Data = Default Location And yet, when I do a command line build, for each of the sub projects, a "build" folder is created alongside the sub project's xcodeproj file. Note that this project is quite old, going back many Xcode versions. I had previously had Xcode > Settings > Locations > Advanced set to "Legacy", but am shifting these old projects to use the default DerivedData location – this might be part of the problem, given that the Legacy mode always created a "build" folder next to the .xcodeproj file. Can anyone explain this? Best Wishes, Mark
1
0
450
Jan ’25
Error while reading test baseline file
When running Unit tests on my project, I get an error: Error while reading test baseline file: "The file “05ACE933-24F8-449B-9949-77312B3070BC.plist” couldn’t be opened because there is no such file." at path: "/private/var/folders/qy/g9s46vp88xggk_001s62kxb00000gn/X/54A3BAF3-89F8-52E2-8575-47176446C08E/d/Wrapper/MyApp.app/PlugIns/MyAppTests.xctest/xcbaselines/05ACE933-24F8-449B-9949-77312B3070BC.plist" This happened after a rebase / merge, so I must have accidentally deleted a file from the repository. This only seems to happen on the 'My Mac (Designed for iPad) device. When I run the unit tests on my iPhone, all seems to be well. How can I either remove the reference to the missing file, or reset the baselines in the project? Kind regards, Wouter Wessels
2
1
501
Jan ’25
Can't compile asset catalog when including iMessage App Icon asset
I'm trying to add an iMessage extension to my app, and upon adding the iMessage App Icon set, I ran into an issue with one specific icon size: 1024x768px, aka 1x 1024x768pt. When I remove this one icon from the icon set, it compiles and runs fine, however I can't push it to the App Store as I get the error: "Asset validation failed. Missing Image Asset. Your app is missing the Large App Icon asset 'AppIcon' in 'Payload/Runner.app/PlugIns/MessagesExtension.appex'." I'm assuming this refers to 1024x768px, as this size placeholder appears upon adding a New Messages Extension Icon to my assets folder, and 1024x1024 is already included and compiles fine with it. However, when I add the 1024x768 icon, and try to run the app, I get the error: "Command CompileAssetCatalog failed with a nonzero exit code" The app icon's filename is correct, it is exactly 1024x768 px, and my contents.json correctly includes : { "filename" : "AppIcon_1024x768.png", "idiom" : "ios-marketing", "platform" : "ios", "scale" : "1x", "size" : "1024x768" } as is the same format for all of my other icons that work. Why am I running into this issue upon inclusion of this one required size? How do I fix it?
2
0
748
Jan ’25
Preview Start Problem
Hello Apple Developer Community. I have a Problem with Xcode Preview. The Problem is that when I try to start the Preview in Xcode (Not Simulator) It crashes and when I try to click Reopen, it says that I must Update my Mac OS, but my Mac OS is Up-to-Date. Can you help me with this? Thank you :D
2
0
332
Jan ’25
Xcode 16.2 cannot run old projects
I use a 2020 Intel MacBook Pro with 14.7.2 (23H311) system. I have been using Xcode 15.4 to develop and publish games. Since new games need to be developed and published using Xcode 16.2, I recently installed two versions of Xcode on my computer. I can run the project normally with Xcode 15.4, but it keeps reporting errors with Xcode 16.2 and cannot run. The error is in UIKit's UIFocusSystem.h file, with the following message: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIFocusSystem.h:46:27 Expected ')' This makes me very confused. Is there something wrong? I thought it was because the computer could not have two Xcodes, so I uninstalled both Xcodes and then downloaded the 16.2 version of Xcode from the AppStore. However, after running it, it still reported the error Expected ')'
1
0
751
Jan ’25
Undefined time_t in openssl
I'm having trouble compiling my project for the iOS 18.2 simulator. I'm getting the following error: `Missing '#include <sys/_types/_time_t.h>'; 'time_t' must be declared before it is used` The error points to to simulartor-iOS 18.2 > user/include/sys/_types/_time_t.h #ifndef _TIME_T #define _TIME_T #include <machine/types.h> /* __darwin_time_t */ typedef __darwin_time_t time_t; #endif /* _TIME_T */ This suggests that the time_t type should be defined, but the compiler isn't seeing it. I suspect there might be a problem with preprocessor definitions. Is there anything I set wrong? I am using OpenSSL.xcframework.
0
1
227
Jan ’25