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

Xcode Documentation

Post

Replies

Boosts

Views

Activity

After building the Watch app, Xcode prompted 'Could not install the preview host' test Watch App. app 'on Apple Watch Series 10 (46mm)
I don't know where the settings were set incorrectly. Unable to install and use applications in preview and virtual machines. I have tried many online methods but have not been able to solve it. It seems that the compiled app file cannot be found. The folder structure of Build is as follows: Build Intermediates.noindex Products Debug-iphonesimulator Debug-watchsimulator Thank you all for your assistance.
0
0
111
1w
How do I query the "+" button in XCTest?
I have a + image in the UI from the following code struct QueryPlusButton: View { var body: some View { Button { } label: { Image(systemName: "plus") } } } However, I'm not able to query the + image in XCTest using any of the following queries let view = app.images["plus"] //let view = app.staticTexts["plus"] //let view = app.buttons["plus"] XCTAssertTrue(view.exists, "Plus button does not exist") The test fails. Is there a methodical way to determine what a query is for any UI element? Thank you.
1
0
116
1w
Project Navigator Broken in Xcode 16? Drag and Drop to Reorder Files Doesn't Work. "New Groups" Creates New Folders.
I just created a new project in the newest version of Xcode as a sample project for a feedback. Bug 1 So simply what I do in every new project is create a "Supporting Files" group (not a folder because I don't want to move these files on the file system). I put the following files in this group: .entitlements file -the Info.plist (which apparently new projects don't create anymore because I don't see one). main.m Assets.xcassets In previous version of Xcode this was done with the "New Group without Folder" action (though back in the day I believe you'd get yellow folders in "New Group" and blue folder with 'New Folder" and they were separate actions.... which was actually better and much less insane IMO but that's not really important to this). In any case, "New Group without Folder" is nowhere to be found in the context menu. I finally was able to get "New Group" to appear as long as I wasn't right clicking underneath any directory. But.... New Group actually creates a New Folder, just like New Folder. So I put the .entitlements in the Supporting Files group (which is not a group, but a directory) and the app won't compile unless I fix the path in project settings because I moved the file which is most definitely not what I wanted. So we can no longer group files in the project navigator without moving them to new directories? Is this intentional behavior? It can't be, right? Bug 2 I noticed dragging and dropping to reorder files in the project navigator no longer seems to work? In previous versions of Xcode I could drag and drop to reorder files (in groups and in folders, this would work). This appears to no longer work. I just have to accept the way Xcode orders my project files?
4
0
251
1w
Project needs migration
I have developed my flutter app in Android studio on my HP computer and now that I am trying to run it on the MacBook Pro that I have, I always get this "Error: Your Xcode project requires migration. See https://docs.flutter.dev/ios-project-migration for details." I got into a lot of detail with this and also tried everything the page says of the url given but I cannot seem to get over this problem.
1
0
90
1w
Class name duplication between core data and Apple private framework
After updating to Sonoma and Xcode 16, I get this when I run my macOS (objective C) app from Xcode: Class Trace is implemented in both /System/Library/PrivateFrameworks/AudioAnalytics.framework/Versions/A/AudioAnalytics (0x273300e68) and /Users/jean/Library/Developer/Xcode/DerivedData/STRyper-ezekeictrpwjnggxusdnbwqpzqtf/Build/Products/Debug/STRyper.app/Contents/MacOS/STRyper (0x10015b8f0). One of the two will be used. Which one is undefined. How do I solve this without changing the class name? Trace is a subclass of NSManagedObject. FYI, the core data model uses the "Xcode 8.0" tools version and the module of the class is set to "Global namespace". Changing the class name doing so would force me to create a new core data model, and mess with other things as I encode some core data objects to files using NSCoding (which uses class names). Thanks.
1
0
107
1w
error: unknown type name 'CFAttributedStringRef'
OS ERROR] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTTypesetter.h:104:27: error: cannot combine with previous 'type-name' declaration specifier [OHOS ERROR] CFAttributedStringRef string ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0)); [OHOS ERROR] ^ [OHOS ERROR] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTTypesetter.h:132:27: error: unknown type name 'string'; did you mean 'std::string'? [OHOS ERROR] CFAttributedStringRef string, [OHOS ERROR] ^ [OHOS ERROR] ../../prebuilts/clang/ohos/darwin-arm64/llvm/bin/../include/c++/v1/iosfwd:249:65: note: 'std::string' declared here [OHOS ERROR] typedef basic_string<char, char_traits, allocator > string; [OHOS ERROR] ^ [OHOS ERROR] In file included from ../../ide/tools/previewer/util/unix/ClipboardObjc.mm:18: [OHOS ERROR] In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13: [OHOS ERROR] In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:15: [OHOS ERROR] In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSAccessibilityColor.h:9: [OHOS ERROR] In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSColor.h:46: [OHOS ERROR] In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:10: [OHOS ERROR] In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSResponder.h:10: [OHOS ERROR] In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:10: [OHOS ERROR] In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:39: [OHOS ERROR] In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.h:26: [OHOS ERROR] In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTFramesetter.h:21: [OHOS ERROR] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTTypesetter.h:132:5: error: unknown type name 'CFAttributedStringRef'; did you mean 'NSAttributedStringKey'? [OHOS ERROR] CFAttributedStringRef string, [OHOS ERROR] ^ [OHOS ERROR] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSAttributedString.h:22:20: note: 'NSAttributedStringKey' declared here [OHOS ERROR] typedef NSString * NSAttributedStringKey NS_TYPED_EXTENSIBLE_ENUM; [OHOS ERROR] ^ [OHOS ERROR] In file included from ../../ide/tools/previewer/util/unix/ClipboardObjc.mm:18:
0
1
97
1w
Xcode 16 Error AppShortcut phrases may have at most one parameter
I suppose this is a bug in compiler. Xcode 16.0 (16A242d) - AppStore release version When building a project from Xcode 15 in Xcode 16, an error occurs: appintentsmetadataprocessor[12633:13677489] error: At least one halting error produced during export. No AppIntents metadata have been exported and this target is not usable with AppIntents until errors are resolved. AppShortcut phrases may have at most one parameter, but found phrase, "Set Dark Mode ${darkMode} for Widget ${widget}" with more than one parameter: darkMode, widget Apparently this is an Xcode bug because I have a production app with this AppShortcut and it works fine in Apple Shortcuts. Everything is made according to the official WWDC video about AppShortcuts https://developer.apple.com/videos/play/wwdc2022/10170
0
1
150
1w
Compatibility Issue with WebKit.WKWebView.evaluateJavaScript(_:completionHandler:) in Xcode 16
I've encountered an issue after upgrading to Xcode 16. I have an overridden func of WebKit.WKWebView.evaluateJavaScript(_:completionHandler:), which no longer compiles in the new Xcode. I noticed that in Xcode 16, the completionHandler now has @MainActor and @Sendable annotations, which causes a compilation error. public override func evaluateJavaScript(_ javaScriptString: String, completionHandler: (@MainActor @Sendable (Any?, (any Error)?) -> Void)? = nil) When I add these annotations to my overridden method, it compiles fine in Xcode 16. However, this breaks compilation in older versions of Xcode. The documentation for this API doesn't explicitly mention any changes, but the behavior is clearly different between versions. https://developer.apple.com/documentation/webkit/wkwebview/1415017-evaluatejavascript Xcode 15: Xcode 16: What would be the best way to handle this situation? Should I use a compilation condition to differentiate between the versions? If so, what would be the correct condition to check? Was there a Swift compiler update in Xcode 16 that could be affecting this? Or is it better to drop support for versions of Xcode earlier than 16? Or I should not override that? Thanks in advance for any insights!
4
1
245
1w
Can't install any apps on my new iPhone 16 Pro with iOS 18 from XCode
Error message: Previous preparation error: The developer disk image could not be mounted on this device.; Error mounting image: 0xe800010f (kAMDMobileImageMounterPersonalizedBundleMissingVariantError: The bundle image is missing the requested variant for this device.) I had no issues previously with my iPhone 13 Pro running iOS 18 and my XCode 15. Now, after switching to the iPhone 16 Pro, it won't work. I've tried restarting my phone several times, quitting XCode, removing and readding developer mode—nothing quite works.
18
20
4.4k
1w
Could not build Module 'UIKit'
Im currentrly having this issue when compiling iOS for my react native app. The error is "Could not build Module 'UIKit'" which brings more subsequent errors down the line like "Could not build module 'DarwinFoundation'" and "Could not build module 'Foundation'. Might it be an error of dependencies or something like that. Im currently on MacOS sequoia, running XCode 16 and trying to build on iOS 18 with react native 0.75.3. For context, i inherited the project with React native 0.69.7 and had to upgrade. Please help, i've been stuck for days and i do not know what to do. Everything in the internet talks about XCode 16 beta but not the actual public release.
1
0
196
1w
WebKit binary compatibility broken in iOS 18
The non-async signature for WKNavigationDelegate's decidePolicyForNavigationAction has changed between iOS 17 and 18. In 17 it is func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) In 18 it adds the MainActor attribute to the decision handler func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping @MainActor (WKNavigationActionPolicy) -> Void) We deliver xcframeworks to our customers with objects that implement this function, and when those customers upgraded to Xcode 16.0 / iOS 18, those frameworks broke despite ABI stability (since that's unrelated to the WebKit SDK's public signatures). I presume this is because the WebKit dependency in the iOS 18 SDK does not match the signature used those older frameworks (and the IDE errors seem to support this). We will of course deliver new frameworks targeting the new SDK, but that takes regression testing and release planning. In the meantime, this has been exacerbated by the fact that macOS Sequoia does not support Xcode 15. Those of our customers whose machines updated to Sequoia cannot build their projects at all until we're able to deliver frameworks that are compatible. Was this an expected change? I didn't see any deprecation warnings in iOS 17, and unless we're supposed to bundle WebKit within the framework somehow, I'm not sure how we could have done this without forcing the Xcode versioning on our customers. Is there a way we package this differently or some other solution to make our existing frameworks compatible with iOS 18 without having to target that SDK?
3
0
252
1w
Xcode 16 Typed Allocators
From the Xcode 16 Release notes: Clang New Features Clang now supports generating code to call typed allocators. To enable this support for C allocation functions such as malloc() set the CLANG_ENABLE_C_TYPED_ALLOCATOR_SUPPORT build setting to YES. For C++ allocations with operator new, set CLANG_ENABLE_CPLUSPLUS_TYPED_ALLOCATOR_SUPPORT to YES. (132456928) Looking in the Build Settings I don't see anything that says Typed Allocator or something similar. I would love to have a bit more information about what this is as well.
2
0
109
1w
Xcode - Product > Archive files
Hello. I'm working on an app which works on multiple platforms (iOS, macOS, watchOS, tvOS). It builds and runs fine on the simulator and a real device but when trying to create a Product > Archive on macOS, it fails. Here's the error message I get: Build target RailBoardMac Project RailBoard | Configuration Debug | Destination Any Mac | SDK macOS 15.1 Link RailBoardMac (x86_64) 0.3 seconds Could not parse or use implicit file '/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SwiftUlCore.framework/ Versions/A/SwiftUlCore.tbd': cannot link directly with 'SwiftUlCore' because product being built is not an allowed client of it less Undefined symbol: _main × Linker command failed with exit code 1 (use -v to see invocation) Build failed 20/09/2024, I know this used to work. I must have changed something somewhere and it no longer does. I'd be grateful for any assistance.
4
0
119
1w
[WatchOS 11, Xcode 16] Can't get watch to appear in Xcode
This morning I bought my first-ever Apple Watch for the sole purpose of development and proceeded to spend six hours failing at the first step of development: getting the device to enter developer mode and connect to Xcode. Since I'm not seeing any WatchOS 11 posts on this issue, it might just be me. This is why I'm making a new thread that's specific to WatchOS 11, Xcode 16, and maybe Series 10. Some particulars for my case: Overall __Followed Xcode 16.0 documentation On a watchOS device that you use for development, go to Settings > Privacy > Developer Mode. To toggle Developer mode, use the Developer Mode switch. To pair an Apple Watch to a Mac, connect its companion iPhone to the Mac with a cable, and ensure that the iPhone is paired for development. After this step, follow any instructions on the Apple Watch to trust the Mac. When paired through an iPhone running iOS 17 or later, Xcode connects to the Apple Watch over Wi-Fi __Tried all the folk remedies listed in the (many) previous posts on enabling development mode and connecting to Xcode iOS 18.0 __In developer mode __Connected to macOS via USB, trusts computer WatchOS 11.0 __Prompt to trust computer appears and trust is established __‘Developer Mode’ list item never appears at end of the ‘Privacy’ menu under ‘Settings’ __‘Developer’ item sometimes appears at the end of ‘Settings’ Despite never having seen or toggled ‘Developer Mode’ under ‘Privacy’ Persists across reboots Possible that WatchOS 11 eliminated the item under Settings > Privacy? If so, documentation not up to date Xcode 16.0 __Watch never appears under ‘Manage Run Destinations’ After installing sample app to phone, then attempting to install WatchOS app via iOS Watch app, “Cannot install at this time” alert appears App icon appears on watch, and tapping on it leads to an alert with, “This app cannot be installed because its integrity could not be verified”, despite wi-fi working Watch apps for other apps (e.g. Apple Store) can be successfully installed via iOS Watch app Above suggests the watch isn't truly in developer mode despite Settings > Developer appearing and persisting across reboots __The network path from Xcode to WatchOS should be clear Reconfigured router such that devices on the same network can talk to each other iPad and iPhone appear with network icon when not connected via cable and Xcode can run code on them Watch on same network as iPad and iPhone macOS 15.0 __Due to security policy, cannot use Wi-Fi (disabled both physically and via sudo /usr/sbin/networksetup -setnetworkserviceenabled 'Wi-Fi' off) Possible that Xcode can only establish a connection to WatchOS via Wi-Fi and not via ethernet bridged to wifi. If so, a confirmation would be hugely helpful. This is currently my prime suspect. Wi-fi cannot be re-enabled, so I'm trying workarounds like connecting watch to phone's hotspot (doesn't work) and somehow using phone to provide network to the Mac. __Due to security policy, firewall configured to block all incoming connections Shouldn't be an issue since Xcode doesn't need incoming connections to see non-watch devices __Due to security policy, mDNSResponder and mDNSResponderHelper disabled Also shouldn't be an issue, but including just in case
1
1
254
1w
Xcode 16 Objective-C Documentation Missing
In Xcode 16.0 and 16.1 beta 2, running on macOS 15.1 beta 4, Developer Documentation for Objective-C is (at least partially) missing in the Navigator. Many of the entries appear to be for Swift. In Xcode 16.1 beta (i.e. beta 1), the documentation is normal. I did not find any posts in this forum about this, which is surprising and makes me wonder if the issue is isolated to particular configurations. In any event, I would appreciate any information anyone may have about this.
4
0
154
1w
Unnecessary rebuild spm package on watchOS target for Debug configuration
We have a problem with undesirable rebuild with Debug configuration for watchOS target dependencies. There is a iOS project with watch extension target. Both have some SPM package dependency. Build Active Architecture Only for Debug is Yes for both app/extension targets. When build app, watch target is building not only for active arch(arm64) but also i386/x86_64. It can be fixed by adding Excluded Architectures = i386 x86_64 for watch target. But it don't help to avoid rebuild SPM package dependency for this architectures.
3
0
156
1w