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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

For iOS is not a valid binary
I have a problem uploading to testflight. When I archived my app, it announced success, but when I went to the appstoreconnect website I didn't see any builds, while I waited a long time for it to be pushed up. And one more problem, when the upload notification is uploaded, after a while there is a notification that my app for ios is not a valid binary, I don't understand this problem. Can you please ask me how to solve it?
0
0
427
Dec ’24
Unstable `archive` for `Debug` configuration (ld: file cannot be open()ed, errno=2)
We have a relatively big iOS-only project with around 80 build targets from swift packages (local features and external project dependencies) and Xcode 15.4 (originally, migrated to 16.0). Project compiles and runs great, but xcodebuild archive will fail 4 out of 5 tries with this: ld: file cannot be open()ed, errno=2 path=/opt/builds/fLLyxmhG/0/myapp/Build/Intermediates.noindex/ArchiveIntermediates/myapp (Development Flow)/BuildProductsPath/Debug-iphonesimulator/Account.o in '/opt/builds/fLLyxmhG/0/myapp/Build/Intermediates.noindex/ArchiveIntermediates/myapp (Development Flow)/BuildProductsPath/Debug-iphonesimulator/Account.o' Where Account.o is an end product of one of our feature packages linking to an .app itself. This error is not tied to this concrete package/product (which should be compiling almost last relative to build graph) and could appear mid-build in between our service layer packages. It seems (and is approved by Xcode timeline for .app archive log) that module dependency is compiled later than module itself and linker just cant find its dependency object files. The scheme is: Module A (dependency itself) Module B (needs module A) And with build order expected (???) to be A (first) -> B we're getting the B -> A. Error appears only when archiving for Debug configuration, archiving the same end-target with Release configuration results in stable passes 10 out of 10 tries. Setting identical parameters in Build Settings tab for both configurations of a target is not giving any effect. Our current fix is choosing Manual order in scheme Build order setting. Everything works as expected, but i guess it's not optimal 🤧 Sadly can't provide test project, but anything else — welcome.
0
1
417
Dec ’24
Can't seem to get Unit Test target working when I create. Multiplatform project
In Xcode Version 16.1 Create a new Project, choose Multiplatform, App For testing system, choose XCTest and UI Tests In the project, open the newly generated template Unit test file Click either of the diamonds in the left margin (either to run the example test or the entire file) Expected Result: Code compiles and then Runs the test/tests Actual Result: Code compiles, but then never completes testing (the top status bar is stuck saying "Testing..." forever.) Am I missing something?
0
0
412
Dec ’24
xcodebuid failed at signing step although there is no issue building and distributing from Xcode GUI
Hi all, I have a host application to register and start network system extension. I created 2 provisional profiles that grant SystemExtension and NetworkExtension capabilities for the host app, and NetworkExtension for the network system extension. I'm able to archive and distribute (direct distribution) the app from XCode GUI. However, when I use xcodebuild command to build the project, it gave me this error: error: No profile for team 'TEAMID' matching 'Host APP Distribution Profile' found: Xcode couldn't find any provisioning profiles matching 'TEAMID/Host APP Distribution Profile'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the Signing & Capabilities tab of the target editor. error: No profile for team 'TEAMID' matching 'My NetworkExt Distribution Profile' found: Xcode couldn't find any provisioning profiles matching 'TEAMID/My NetworkExt Distribution Profile'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the Signing & Capabilities tab of the target editor. I already installed those 2 provisioning profiles assign them to my targets in XCode. There is no error from Xcode when building and distributing it. Does anyone have the same issue? How could you solve it. Thanks! An
0
0
231
Dec ’24
Xcode 16.1: Swift macro killing indexing performance?
I'm working on a project with several dozen targets and a Swift macro. Due to the purpose of the macro (generating Codable boilerplate), pretty much all targets depend on it. The project is generated with XcodeGen. Since upgrading to 16.1 (I think), Xcode has basically turned into a glorified TextEdit for me: refactoring, symbol navigation and search don't work. Also, I'm getting a lot of ghost errors that keep popping up hours after I fix them, while at the same time new build errors never show up in the error navigator, so I have to check the build log to see why the build failed. I noticed that project indexing is taking a very long time. As a troubleshooting step, I tried deleting DerivedData (which afaik includes the index) to see if this fixes the problem. Xcode started indexing the project from scratch, and if the progress indicator is to be trusted, After ~40 minutes it's only about 1/3 done. For every target Xcode seems to be spending a lot of time indexing SwiftOperators, SwiftDiagnostics, SwiftParser. I'm assuming these are related to the macro. Does anyone else have this problem? Unfortunately, I can't confirm this is caused by the macro, removing it from the project and seeing if this fixes the issue seems infeasible.
0
0
382
Dec ’24
ML model performance on iPhone test is always 0
Hi, Im using Xcode to test ML model performance. When I create a performance report on my Mac, I can get the performance report with prediction, load and Compilation time in ms. But when I tried to test the performance on iPhone16pro, although the test came to an end normally, but the prediction/load/compilation time are always 0, and there were no Compute Unit Mapping below. Thanks for your help.
0
0
294
Oct ’24
Automating import of distribution certificates for iOS builds
We build a number of iOS apps using different distribution certificates on a "headless" build machine in a data center. It is a burden to have to accept a newly imported certificate because codesign causes a dialog to pop up requesting to authorize the private key We have tried a number of suggestions in various posts, including deleting the certificate and re-importing with security import using the -T flag to allow codesign. After doing this, and even though the ACL shows a very similar picture to the post authorized state, keychain still requires a dialog to be "Allowed". What can be done, from the command line, to avoid this popup?
0
0
242
Oct ’24
How to -disable-dynamic-actor-isolation FLAG
When I built my app with xCode16.2, the app crashed at runtime. When building, I got a warning "UIWebView' is deprecated: first deprecated in iOS 12.0 - No longer supported; please adopt WKWebView.", so I suspected the dynamic actor isolation check. When building, I tried setting the "-disable-dynamic-actor-isolation" flag, but the app still crashed. However, I think the flag is not set properly, so how should I set the "-disable-dynamic-actor-isolation" flag? I tried setting it as follows. Is this the correct way to set it? Swift Compiler - Custom Flags Other Swift Flags Debug Any Architecuture | Any SDK -disable-dynamic-actor-isolation Release Any Architecuture | Any SDK -disable-dynamic-actor-isolation
0
0
174
Dec ’24
Unknown file type error in Xcode
Hello! I have been successfully building out my Xcode project in the past few months to my iPhone 15. I recently got a new iPhone 16 pro and have been having a hell of a time trying to figure out how to build to my new phone. Here's the error I am getting: Unknown file type in '/Users/username/Desktop/filename/Libraries/libiPhone-lib.a' please help! Any suggestions would be greatly appreciated. NOTE: I am using a M1 laptop with Sequoia OS
0
0
686
Oct ’24
Provisioning profile "iOS Team Provisioning Profile: com.X" doesn't include the com.apple.developer.cksharing entitlement.
Hey all - Been building my app and all has been going well with successful builds through to test flight. However, I have just added CKSharing support into the app and therefore into the entitlements to allow collaboration within the app. As soon as I have added this, I can no longer build due to a signing certificate error stating my provisioning profile just not allow for CKSharing... "Provisioning profile "iOS Team Provisioning Profile: com.MyApp" doesn't include the com.apple.developer.cksharing entitlement." However, iCloud is enabled within my app profile, and all other cloudkit features have worked up until adding that specific entitlement. Any help or guidance to get passed this would be greatly appreciated.
0
0
484
Nov ’24
Xcode 16.2 Beta 3 makes min deploy to iOS 16 for swift/cpp mixed projects
Below copied from my original post here: https://forums.swift.org/t/xcode-16-2-beta-seems-increase-the-min-deploy-to-16-0-for-swift-cpp-mixed-project/76221 Our games are set to min deploy of iOS 12.0. When building with the Xcode 16.2 beta3, the Xcode 16.1 build-able project will have errors for those static libs that has swift mixed with C++: Compiling for iOS 12.0, but module 'Cxx' has a minimum deployment target of iOS 16.0: /Users/trout.zhang/Documents/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/Cxx.swiftmodule/arm64-apple-ios.swiftmodule Change that static lib min deploy to 16.0 can make the build succeed, while maintain the exe target still use iOS 12.0. I am not familiar with how the min deploy works, is it: choosing the highest of exe and its dependencies, thus effectively set the final product has min deploy of iOS 16.0 or maintaining exe's iOS 12.0 and actually crash in runtime if the iOS is less than 16.0, when reach the code in that static lib. Apparently, non of the above is what we want. Use cat in cmdline, for Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/Cxx.swiftmodule/arm64-apple-ios.swiftdoc with both Xcode.app(16.1) and Xcode-beta.app(16.2 beta3), I found the different lines: Xcode 16.1 has: Apple Swift version 6.0.2 effective-5.10 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)Cxx?arm64-apple-ios11.0 Xcode 16.2 beta 3 has: Apple Swift version 6.0.3 effective-5.10 (swiftlang-6.0.3.1.8 clang-1600.0.30.1)Cxx?arm64-apple-ios16.0
0
2
905
Nov ’24
How to start and automatically update/end a local live activity?
I'm implementing a timer feature and facing the issue that the live activity I'm starting just continues showing after the timer is complete. The body of the live activity widget is more or less: ActivityConfiguration(for: WhendyWidgetAttributes.self) { context in VStack { Text( context.state.timerEndDate, style: .timer ) // if Date.now < timerEndTime { Text("Done") } self.expandedView(state: context.state) } } … Ideally I could get the activity to show something else when it is done but I don't know how to get it to re-evaluate it's body once the end time is reached. I create the activity with let activity = try ActivityKit.Activity.request( attributes: attributes, content: .init( state: .init(timerEndDate: timerEndDate), staleDate: timerEndDate ), pushType: nil ) Can I schedule the activity to do a refresh it's body (and reevaluating Date.now) once the timerEndDate is reached? Considered Approaches trying staleDate However, the activity never shows that it has become stale. Would it be expected that it shows the stale-ness? scheduling dismissal I also thought about starting and immediately stopping the activity with a delayed dismissal, but unfortunately it seems this is limited to a 4 hour window, and I'd like longer timers too. remote updates I understand I could use remote notifications to update the live activity, but I'd really like to keep things local as all the functionality is locally plannable. Background Tasks I understand these don't run reliably or at a predictable time. A Timer in the app that updates the content I think this would only update the activity while the app is in foreground.
0
0
506
Nov ’24
When AppEnum or AppEntity is introduced into the iOS18 Widget file, xcode compilation will report an error: Error collecting extracted types: The file “SmartPlusWidgetControl.swift” couldn’t be opened because the text encoding of its contents can’t b
When AppEnum or AppEntity is introduced into the iOS18 Widget file, xcode compilation will report an error: Error collecting extracted types: The file “SmartPlusWidgetControl.swift” couldn’t be opened because the text encoding of its contents can’t be determined.
0
0
199
Sep ’24
boringss1_metrics_log_metric_block_invoke (153) Failed to log metrics
i created a new project and imported firebaseauth , firebasefirestore, firebasefirestoreswift and firebase storage and i run this project any time i run this project the code they are all fine i get this error saying boringss1_metrics_log_metric_block_invoke (153) Failed to log metrics anytime i click create account button note that i get them results in my firebase authentication but it seems not to pass the registration page in my project and prints that error i am stuck somebody please save me even when i try to login the already created account from the userSection from the auth.authservice it still shows this error and wont pass the login page same with the registration page
0
0
229
Nov ’24