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

Xcode Documentation

Post

Replies

Boosts

Views

Activity

Xcode 14.3.1 for Ventura 13.6.9
Where do I download this version of Xcode? Xcode 14.3.1 Or whatever is the latest version for Ventura 13.6.9 I'm trying to learn Unreal Engine which is asking for Xcode to be installed. When I got to the app store I get an error: "Xcode can’t be installed on “2017 iMac27” because macOS version 14.5 or later is required." Please advise Thanks
1
0
121
6d
Pls validate workaround for Predictive Code n/a on external boots
What minimal changes can I make to use Xcode 16+ predictive code completion (PCC) when I've been booting from external drives (on the same apple-silicon machine)? PCC says it requires booting from an internal drive. I boot from external for a host of reasons that aren't going to change, but need to investigate whether/how I should accommodate PCC. I haven't found technical communications on PCC requirements, and I hate to guess (wrong) because OS/workflow reconfiguration is hard and disruptive. So this post is to ask whether my approach would work, or if there's a better one. I hope to continue using the external for the user home directory, the installed Xcode application, and Xcode temporary files (and of course the projects and artifacts). (a) Does the "internal drive" requirement extend only to booting, or also to installing Xcode or situating the user HOME dir? (b) Can one use the same external HOME directory for a user booting alternately from an internal and external drives? I would doubt it since the OS's would conflict e.g., in the HOME/Library state. So I assume that means we use separate HOME dir's, but link key user HOME directories to external/real HOME (git, etc. - also .ssh?). Then OS's have distinct views, but user has mostly common view. (Assuming user always codes/builds for least-common-denominator.) Aside: is it possible to redirect the system var/temp to an external? (c) Xcode signing for the same machine/CPU seems locked to a specific OS. I.e., to switch between OS drives but do code signing in Xcode, I've had to re-issue a certificate. (c-1) Is that avoidable? (c-2) Can I somehow maintain a per-machine certificate, and toggle between them? (c-3) Is that process made possible or impossible if Xcode is always pointing at the same Derived-Data/Archives directories? Is there any way to make it semi-automatic, once configured? Thank you! (I didn't see any forum tag for PCC.)
2
0
112
1w
FCP Workflow extension does not build with clang unknown argument -e_ProExtensionMain in Xcode 16
With Xcode 16 I cant make the Final Cut Extension Workflow work. I am quite sure I was able to add the Workflow Extension target a couple of months ago in Xcode 15 and did successfully build it, but in Xcode 16 it wont build and it fails with this error: clang: error: unknown argument: '-e_ProExtensionMain' I have installed multiple times Workflow Extensions SDK 1.0.2 and even disabled Library validation like its described in the release notes but I dont think thats the problem here. Seems like clang doesn't have the arguments for it, I guess the SDK should add these but seems like something got messed up - the template shows up fine in Xcode. I reinstalled Xcode and command line tools but that didnt help. Checking clang it really doesnt have the argument. But where does the SDK add this? Xcode seems to be using internal clang and /usr/bin/clang doesn't have it either. Any tips what could be the problem here? I was not really able to locate the SDK to remove it before trying to install again - any ideas? Steps to reproduce Create new project Add FCP workflow extension target Build -> it fails Same behaviour with 16.1 Beta. I am running Sonoma 14.7. Thanks in advance for any ideas!
3
0
127
1w
Xcode 16 Do not display comments correctly
Comments are not displayed correctly in Xcode 16. As you can see on the included screenshot, the first /// are displayed correctly but the remaining ////////////////////////// are super small. In a programming text editor, like Xcode, all characters MUST be monospaced. Otherwise it is impossible to code. Xcode is not supposed to be a word processor. There are no parameters to fix that. It was working fine for the past 15 years on Xcode. Please fix that so I can work again. And never do that ever again. Understood?
6
0
175
1w
Trouble with getting a background refresh task working
I am able to setup and schedule a background refresh task as well as manually trigger it via Xcode and the simulator tied to my iPhone 11 Pro test phone using the e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier: However, it won't execute on the app on it's own. And yes, the pinfo.list entries are correct and match! I know the scheduler is not exact on timing but it's just not executing on its own. Since I can trigger manually it I'm pretty sure the code is good but I must be missing something. I created an observable object for this code and the relevant parts look like this: class BackgroundTaskHandler: ObservableObject { static let shared = BackgroundTaskHandler() var taskState: BackgroundTaskState = .idle let backgroundAppRefreshTask = "com.opexnetworks.templateapp.shell.V1.appRefreshTask" func registerBackgroundTask() { BGTaskScheduler.shared.register(forTaskWithIdentifier: backgroundAppRefreshTask, using: nil) { task in self.handleAppRefresh(task: task as! BGAppRefreshTask) } self.updateTaskState(to: .idle, logMessage: "✅ Background app refresh task '\(backgroundAppRefreshTask)' registered.") BGTaskScheduler.shared.register(forTaskWithIdentifier: backgroundTaskIdentifier, using: nil) { task in self.handleProcessingTask(task: task as! BGProcessingTask) } self.updateTaskState(to: .idle, logMessage: "✅ Background task identifier '\(backgroundTaskIdentifier)' registered.") } // Handle the app refresh task private func handleAppRefresh(task: BGAppRefreshTask) { self.updateTaskState(to: .running, logMessage: "🔥 app refresh task is now running.") PostNotification.sendNotification(title: "Task Running", body: "App refresh task is now running.") let queue = OperationQueue() queue.maxConcurrentOperationCount = 1 let operation = BlockOperation { self.doSomeShortTaskWork() } task.expirationHandler = { self.updateTaskState(to: .expired, logMessage: "💀 App refresh task expired before completion.") PostNotification.sendNotification(title: "Task Expired", body: "App refresh task expired before completion \(self.formattedDate(Date())).") operation.cancel() } operation.completionBlock = { if !operation.isCancelled { self.taskState = .completed } task.setTaskCompleted(success: !operation.isCancelled) let completionDate = Date() UserDefaults.standard.set(completionDate, forKey: "LastBackgroundTaskCompletionDate") self.updateTaskState(to: .completed, logMessage: "🏁 App refresh task completed at \(self.formattedDate(completionDate)).") PostNotification.sendNotification(title: "Task Completed", body: "App refresh task completed at: \(completionDate)") self.scheduleAppRefresh() // Schedule the next one } queue.addOperation(operation) } func scheduleAppRefresh() { // Check for any pending task requests BGTaskScheduler.shared.getPendingTaskRequests { taskRequests in let refreshTaskIdentifier = self.backgroundAppRefreshTask let refreshTaskAlreadyScheduled = taskRequests.contains { $0.identifier == refreshTaskIdentifier } if refreshTaskAlreadyScheduled { self.updateTaskState(to: .pending, logMessage: "⚠️ App refresh task '\(refreshTaskIdentifier)' is already pending.") // Iterate over pending requests to get details for taskRequest in taskRequests where taskRequest.identifier == refreshTaskIdentifier { let earliestBeginDate: String if let date = taskRequest.earliestBeginDate { earliestBeginDate = self.formattedDate(date) } else { earliestBeginDate = "never" } self.updateTaskState(to: .pending, logMessage: "⚠️ Pending Task: \(taskRequest.identifier), Earliest Begin Date: \(earliestBeginDate)") } // Optionally, show a warning message to the user in your app PostNotification.sendNotification(title: "Pending Tasks", body: "App refresh task is already pending. Task scheduling cancelled.") return } else { // No pending app refresh task, so schedule a new one let request = BGAppRefreshTaskRequest(identifier: refreshTaskIdentifier) request.earliestBeginDate = Date(timeIntervalSinceNow: 15 * 60) // Earliest in 15 minutes do { try BGTaskScheduler.shared.submit(request) self.taskState = .scheduled self.updateTaskState(to: .scheduled, logMessage: "✅ App refresh task '\(refreshTaskIdentifier)' successfully scheduled for about 15 minutes later.") PostNotification.sendNotification(title: "Task Scheduled", body: "App refresh task has been scheduled to run in about 15 minutes.") } catch { print("Could not schedule app refresh: \(error)") self.taskState = .failed self.updateTaskState(to: .failed, logMessage: "❌ Failed to schedule app refresh task.") } } } } // Short task work simulation private func doSomeShortTaskWork() { print("Doing some short task work...") // Simulate a short background task (e.g., fetching new data from server) sleep(5) print("Short task work completed.") } In my AppDelegate I trigger the registerBackground task in the didFinishLaunchingWithOptions here: BackgroundTaskHandler.shared.registerBackgroundTask() And I scheduled it here in the launch view under a task when visible: .task { BackgroundTaskHandler.shared.scheduleAppRefresh() } I've also tried the last in the AppDelegate after registering. either way the task schedules but never executes.
3
0
118
1w
macOS 15.1b5, Xcode 16.1b2, does not compile
macOS project, was compiling on macOS 14, now there are errors when trying to compile it again: In file macOS 15.1 / usr/include/ ___wctype.h there are errors: Use of undeclared identifier '_CTYPE_A' in line: return (__istype(_wc, _CTYPE_A|_CTYPE_D)); And further down: Use of undeclared identifier '_CTYPE_A' Use of undeclared identifier '_CTYPE_C' Use of undeclared identifier '_CTYPE_D' Is this an SDK problem?
1
0
106
1w
Problem installing debugging on IOS 18 with Xcode 16
Project previously built and installed fine (Xcode 16). Upgrade to IOS 18 and now debug install 'Prepares' for ever (never finishes) on both my iPhone 11 Pro and my 12.9 iPad. Tried clearing buffers, derived data, restarting/rebooting. The projects are projects that I have tested and run for several years on many versions, not new to the Xcode world. Permissioning (i.e. Developer mode) enabled on all devices, tried various cables on all devices. Relinked all devices..but no success. Projects build and run fine on simulators, but just can't finish installing on the real hardware. Stunning frustrating and NO USEFULL error messages.
2
0
112
6d
loudKit Containers are not being created or connecting back do apple dev besides the default container
Every new container i create for cloudkit doesn't work and or connect back to my icloud dev account. Here are the errors: Communication with Apple failed. An iCloud Container with Identifier 'iCloud.icloud.com.plantclock.backup' is not available. Please enter a different string. Provisioning profile "iOS Team Provisioning Profile: CGL.CannaGrowLog" doesn't support the iCloud.icloud.com.plantclock.backup iCloud Container. Provisioning profile "iOS Team Provisioning Profile: CGL.CannaGrowLog" doesn't match the entitlements file's value for the com.apple.developer.icloud-container-identifiers entitlement. STEPS TO REPRODUCE Went into xcode > Project name > targets > icloud > containers > + sign and anytime i try to add it fails with the above issues. Also, going into apple dev website has no option to even see or add containers.
1
0
118
6d
Errors running with ASAN when targeting iOS Devices
I'm unable to run my app with ASAN enabled when targeting a physical iOS device. Simulator targets do work. With Xcode 12 and an iPad mini 4 running iOS 14 beta 1 I get the following error during app launch ==750==ERROR: AddressSanitizer failed to allocate 0xffffffffff9fc000 (-6307840) bytes at address 2db624000 (errno: 22) ==750==ReserveShadowMemoryRange failed while trying to map 0xffffffffff9fc000 bytes. Perhaps you're using ulimit -v With Xcode 11.5 and an iPad Air 2 running OS 12.4.1 the error is ==2177==Unable to find a memory range after restricting VM. ==2177==AddressSanitizer CHECK failed: /BuildRoot/Library/Caches/com.apple.xbs/Sources/clangcompilerrt/clang-1103.0.32.62/compiler-rt/lib/asan/asanmac.cc:92 "((0 && "cannot place shadow after restricting vm")) != (0)" (0x0, 0x0) <empty stack>==2177==AddressSanitizer CHECK failed: /BuildRoot/Library/Caches/com.apple.xbs/Sources/clangcompilerrt/clang-1103.0.32.62/compiler-rt/lib/asan/../sanitizercommon/sanitizermallocmac.inc:143 "((!asaninitisrunning)) != (0)" (0x0, 0x0) warning: could not execute support code to read Objective-C class data in the process. This may reduce the quality of type information available. AddressSanitizer report breakpoint hit. Use 'thread info -s' to get extended information about the report. (lldb) thread info -s thread #1: tid = 0x1076c2, 0x000000011531e984 libclangrt.asaniosdynamic.dylib`__asan::AsanDie() My coworker is able to use ASAN with the same App using iPad Pro 10.5, iPadOS 13.5.1, Xcode 11.5 Are there any configuration changes I need to make to be able to use ASAN on my devices?
11
1
7.7k
Jun ’20
Can't build with Xcode 14: "Doesn't match platform DriverKit"
I have an app that includes a DriverKit extension that up until now I've been building without issue using Xcode 13. It was time to regenerate my Developer ID Application certificate so I needed to rebuild the app. However, I'm now running macOS Ventura and Xcode 14.3.1, and cannot get it to build in this later version of Xcode for reasons that are totally inscrutable to me. I've tried using both the newly generated provisioning profiles I've manually created in the "Certificates, Identifiers & Profiles" developer page, and the (still valid) provisioning profiles I already had installed. The trouble is that, when I select a provisioning profile I made for the DriverKit extension, Xcode won't accept it for the following reason: Platform: macOS Doesn't match platform DriverKit This makes no sense to me! There is no way to create a distribution provisioning profile for the "DriverKit" platform. All I can select is either "Mac" or "Mac Catalyst". So there's seemingly no way out of this. What am I missing?
0
0
86
6d
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
Not able to inspect react native drop down element in iOS
Am trying to automate below drop down but iOS Accessibility inspector is unable to detect the element. Even we tried with Appium Inspector issue is same. Drop down: https://www.npmjs.com/package/react-native-element-dropdown We tried to debug the dropdown component. In that we can see the value is rendered properly from react. We have raised the issue with Appium, but they have given few suggestions in the Appium setting but it didn't solve. Now it's something that has to be done from XCTest Framework end. Appium issue git link: https://github.com/appium/appium/issues/14825
0
0
53
1w
KeyedUnarchive a previously object archived with NSArchiver archivedDataWithRootObject
Hi, in my previous macOS app I used to archive a dictionary to a preference file using [NSArchiver archivedDataWithRootObject:dictionary]; and to unarchive it using [NSUnarchiver unarchiveObjectWithData:dataFromDisk]; Now I would like to replace the 2 deprecated methods with NSError *error; NSSet *classSet = [NSSet setWithObjects:[NSDictionary class], [NSArray class], [NSString class], [NSNumber class], [NSData class], nil]; NSDictionary *dictionary = [NSKeyedUnarchiver unarchivedObjectOfClasses:classSet fromData:dataFromDisk error:&error]; But I get a nil dictionary and the error 4864: non-keyed archive cannot be decoded by NSKeyedUnarchiver. So I guess I should first keep on unarchiving the preferences dataFromDisk using the old deprecated method [NSUnarchiver unarchiveObjectWithData:dataFromDisk]; Then I could use the new NSKeyedArchiver and NSKeyedUnarchiver methods for the upcoming release. But, if this deprecated method [NSUnarchiver unarchiveObjectWithData:dataFromDisk]; fails to unarchive the old data (and on some machines now it fails), how could I use the new methods? Should I consider my old preference file gone? Is a way to force the new NSKeyedUnarchiver method to unarchive data previously archived with NSArchiver ?
0
0
29
1w
Unable to build Core Image kernels in XCode 16
My app is suddenly broken when I build it with XCode 16. It seems Core Image kernels compilation is broken in XCode 16. Answers on StackOverflow seem to suggest we need to use a downgraded version of Core Image framework as a workaround, but I am not sure if there is a better solution out there. FYI, I am using [[ stitchable ]] kernels and I see projects having stitchable are the ones showing issue. air-lld: error: symbol(s) not found for target 'air64_v26-apple-ios17.0.0' metal: error: air-lld command failed with exit code 1 (use -v to see invocation) Showing Recent Messages /Users/Username/Camera4S-Swift/air-lld:1:1: ignoring file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/CoreImage.metallib', file AIR version (2.7) is bigger than the one of the target being linked (2.6)
0
1
84
1w
Mocking or simulating CBPeripheral, CBCentralManager, etc in tests
I am developing an app that uses CoreBluetooth to communicate with a proprietary piece of hardware. I would like to be able to write tests for it, but there does not seem to be any way to mock or simulate the presence of, for example a CBPeripheral object. This library (https://github.com/NordicSemiconductor/IOS-CoreBluetooth-Mock) almost does what I need, but it's not quite flexible enough. I think they have the right idea, but it doesn't seem to be actively maintained anymore. This seems like a pretty big hole in the iOS SDK. Is there really not an officially supported way of testing BLE functionality?
3
0
172
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