Can someone from Apple officially confirm either a delay or cancellation of this feature? 9 days before 2024 ends and Apple said “later this year” in June 2024. Apple mentioned Swift Assist even in the MacBook Pro announcement on the 30th of October 2024 as if it already exists.
Xcode
RSS for tagBuild, test, and submit your app using Xcode, Apple's integrated development environment.
Posts under Xcode tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hi,
My env. is ..
Xcode: Version 16.2 (16C5032a)
macOS Sequoia: Version 15.1
And I have 2 problems.
Please give me the advice..
Failed Message.
When I run the automatically generated app as it is, the following error(warning?) message appears in the terminal.
Can't find or decode reasons
Failed to get or decode unavailable reasons
NSBundle file:///System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed
Not on the simulator
And the result is not running in the simulator, but instead appears as a window. (The simulator works fine when launched separately, but the app from the current project doesn’t show up in it.)
Hi,
After updating to Xcode 16.2, I am getting an error running all iOS apps. I'm using Sequioa 15.2.
Error creating the CFMessagePort needed to communicate with PPT.
I ran the default Hello World app and got the same error message (plus another error not showing up on my apps - Failed to send CA Event for app launch measurements for ca_event_type: 1 event_name: com.apple.app_launch_measurement.ExtendedLaunchMetrics).
Can I ignore the error or is it truly affecting my app (all are testflight versions and it's fine if I don't update them for awhile, although not ideal).
Hopefully someone can help!
Thanks,
-Ashley
PLATFORM AND VERSION
Vision OS
Development environment: Xcode 16.2, macOS 15.2
Run-time configuration: visionOS 2.3 (On Real Device, Not simulator)
Please someone confirm I'm not crazy and this issue is actually out of my control.
Spent hours trying to fix my app and running profiles because thought it was an issue related to my apps performance. Finally considered chance it was issue with API itself and made sample app to isolate problem, and it still existed in it. The issue is when a model entity moves around in a full space that was launched when the system environment immersion was turned up before opening it, the entities looks very choppy as they move around. If you take off the headset while still in the space, and put it back on, this fixes it and then they move smoothly as they should. In addition, you can also leave the space, and then turn the system environment immersion all the way down before launching the full space again, this will also make the entity moves smoothly as it should. If you launch a mixed immersion style instead of a full immersion style, this issue never arrises. The issue only arrises if you launch the space with either a full style, or progressive style, while the system immersion level is turned on.
STEPS TO REPRODUCE
https://github.com/nathan-707/ChoppyEntitySample
Open my test project, its a small, modified vision os project template that shows it clearly.
otherwise:
create immersive space with either full or progressive immersion style.
setup a entity in kinematic mode, apply a velocity to it to make it pass over your head when the space appears.
if you opened the space while the Apple Vision Pros system environment was turned up, the entity will look choppy.
if you take the headset off while in the same space, and put it back on, it will fix the issue and it will look smooth.
alternatively if you open the space with the system immersion environment all the way down, you will also not run into the issue. Again, issue also does not happen if space launched is in mixed style.
I am trying to setup an extension using DNSProxyProvider that intercepts the DNS traffic on UDP and inserts our custom device identifier and send it to our custom DNS Server which gives us the response which I forward to the requesting client.
I have been able to append the identifier with the domain name when sending out request to our custom DNS and I am getting the response back just fine but when I try to write the response to the udpflow I get this error in Console Logs.
Error Domain=NEAppProxyFlowErrorDomain Code=9 "The datagram was too large" UserInfo={NSLocalizedDescription=The datagram was too large}
Here is what I have tried so far.
Truncating the datagram size to less than 10 bytes.
Sending in dummy Data object while trying to write to the flow.
Double checking the Signing and Capabilities, for Targets, the App and Network Extension.
Attached below is code from my NEDNSProxyProvider. The DNS request is process in the handleNewFlow function which calls processUDPFlow
override func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool {
if flow is NEAppProxyTCPFlow {
NSLog("BDDNSProxyProvider : Is TCP Flow...")
} else if let udpFlow = flow as? NEAppProxyUDPFlow {
NSLog("BDDNSProxyProvider: handleNewFlow : \(udpFlow)")
processUDPFlow(udpFlow) // < --
}
return true
}
In the code below I concatenate domain name in the request with deviceId and send it to our server. Also have the Logs lines in, please ignore them.
// Read incoming DNS packets from the client
self.udpAppProxyFlow = udpFlow
udpFlow.readDatagrams { datagrams, error in
if let error = error {
NSLog("Error reading datagrams: \(error.localizedDescription)")
return
}
guard let datagrams = datagrams else {
NSLog("No datagrams received.")
return
}
// Forward each DNS packet to the custom DNS server
for (index, packet) in datagrams.enumerated() {
let dnsMessage = self.parseDNSMessage(from: packet.0)
NSLog("tDatagram Header: \(dnsMessage.header)")
for question in dnsMessage.questions {
NSLog("tDatagram Question: \(question.name), Type: \(question.type), Class: \(question.klass)")
}
for answer in dnsMessage.answers {
NSLog("tDatagram Answer: \(answer.name), Type: \(answer.type), Data: \(answer.data)")
}
let oldDomain = self.extractDomainName(from: packet.0)!
let packetWithNewDomain = self.replaceDomainName(in: packet.0, with: "827-\(oldDomain)") // func to append device ID
NSLog("Packet's new domain \(self.extractDomainName(from: packetWithNewDomain ?? packet.0) ?? "Found nil")")
self.sendToCustomDNSServer(packetWithNewDomain!) { responseDatagram in
guard let responseDatagram = responseDatagram else {
NSLog("Failed to get a response from the custom DNS server")
return
}
let tDatagram = (responseDatagram, packet.1)
udpFlow.writeDatagrams([tDatagram]) { error in
if let error = error {
NSLog("Failed to write DNS response back to client: \(error)")
} else {
NSLog("Successfully wrote DNS response back to client.")
}
}
}
}
// Continue Reading Datagrams - DO NOT REMOVE!
self.processUDPFlow(udpFlow)
}
}
Following is the function I use to replace domainName
// Ensure the datagram is at least the size of the DNS header
guard datagram.count > 12 else {
NSLog("Error : Invalid datagram: Too small to contain a DNS header")
return nil
}
NSLog("BDLine 193")
// Start reading after the header (12 bytes)
var offset = 12
// Parse the original domain name
while offset < datagram.count {
let length = Int(datagram[offset]) // Get the length of the next label
offset += 1
// Check for the null terminator (end of domain name)
if length == 0 {
// Domain name ends here
break
}
// Validate that the length is within bounds
guard offset + length <= datagram.count else {
NSLog("Error : Invalid datagram: Domain name length exceeds packet size")
return nil
}
// Skip over this label
offset += length
}
Everything is falling into place other than this last Error I get when I try to write back to flow. What am I missing here and how can I resolve this issue?
Any help would be appreciated.
Thanks
I get this message when trying to save my Models.
CoreData: error: SQLCore dispatchRequest: exception handling request: <NSSQLSaveChangesRequestContext: 0x303034540> , I/O error for database at /var/mobile/Containers/Data/Application/726ECA8C-6C67-4BFE-89E7-AFD8A83CAA5D/Library/Application Support/default.store. SQLite error code:1, 'no such table: ZCALENDARMODEL' with userInfo of {
NSFilePath = "/var/mobile/Containers/Data/Application/726ECA8C-6C67-4BFE-89E7-AFD8A83CAA5D/Library/Application Support/default.store";
NSSQLiteErrorDomain = 1;
}
SwiftData.DefaultStore save failed with error: Error Domain=NSCocoaErrorDomain Code=256 "The file “default.store” couldn’t be opened." UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/726ECA8C-6C67-4BFE-89E7-AFD8A83CAA5D/Library/Application Support/default.store, NSSQLiteErrorDomain=1}
The App has Recipes and Calendars and the user can select a Recipe for each Calendar day. The recipe should not be referenced, it should be saved by SwiftData along with the Calendar.
import SwiftUI
import SwiftData
enum CalendarSource: String, Codable {
case created
case imported
}
@Model
class CalendarModel: Identifiable, Codable {
var id: UUID = UUID()
var name: String
var startDate: Date
var endDate: Date
var recipes: [String: RecipeData] = [:]
var thumbnailData: Data?
var source: CalendarSource?
// Computed Properties
var daysBetween: Int {
let days = Calendar.current.dateComponents([.day], from: startDate.midnight, to: endDate.midnight).day ?? 0
return days + 1
}
var allDates: [Date] {
startDate.midnight.allDates(upTo: endDate.midnight)
}
var thumbnailImage: Image? {
if let data = thumbnailData, let uiImage = UIImage(data: data) {
return Image(uiImage: uiImage)
} else {
return nil
}
}
// Initializer
init(name: String, startDate: Date, endDate: Date, thumbnailData: Data? = nil, source: CalendarSource? = .created) {
self.name = name
self.startDate = startDate
self.endDate = endDate
self.thumbnailData = thumbnailData
self.source = source
}
// Convenience initializer to create a copy of an existing calendar
static func copy(from calendar: CalendarModel) -> CalendarModel {
let copiedCalendar = CalendarModel(
name: calendar.name,
startDate: calendar.startDate,
endDate: calendar.endDate,
thumbnailData: calendar.thumbnailData,
source: calendar.source
)
// Copy recipes
copiedCalendar.recipes = calendar.recipes.mapValues { $0 }
return copiedCalendar
}
// Codable Conformance
private enum CodingKeys: String, CodingKey {
case id, name, startDate, endDate, recipes, thumbnailData, source
}
required init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
id = try container.decode(UUID.self, forKey: .id)
name = try container.decode(String.self, forKey: .name)
startDate = try container.decode(Date.self, forKey: .startDate)
endDate = try container.decode(Date.self, forKey: .endDate)
recipes = try container.decode([String: RecipeData].self, forKey: .recipes)
thumbnailData = try container.decodeIfPresent(Data.self, forKey: .thumbnailData)
source = try container.decodeIfPresent(CalendarSource.self, forKey: .source)
}
func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id)
try container.encode(name, forKey: .name)
try container.encode(startDate, forKey: .startDate)
try container.encode(endDate, forKey: .endDate)
try container.encode(recipes, forKey: .recipes)
try container.encode(thumbnailData, forKey: .thumbnailData)
try container.encode(source, forKey: .source)
}
}
import SwiftUI
struct RecipeData: Codable, Identifiable {
var id: UUID = UUID()
var name: String
var ingredients: String
var steps: String
var thumbnailData: Data?
// Computed property to convert thumbnail data to a SwiftUI Image
var thumbnailImage: Image? {
if let data = thumbnailData, let uiImage = UIImage(data: data) {
return Image(uiImage: uiImage)
} else {
return nil // No image
}
}
init(recipe: RecipeModel) {
self.name = recipe.name
self.ingredients = recipe.ingredients
self.steps = recipe.steps
self.thumbnailData = recipe.thumbnailData
}
}
import SwiftUI
import SwiftData
@Model
class RecipeModel: Identifiable, Codable {
var id: UUID = UUID()
var name: String
var ingredients: String
var steps: String
var thumbnailData: Data? // Store the image data for the thumbnail
static let fallbackSymbols = ["book.pages.fill", "carrot.fill", "fork.knife", "stove.fill"]
// Computed property to convert thumbnail data to a SwiftUI Image
var thumbnailImage: Image? {
if let data = thumbnailData, let uiImage = UIImage(data: data) {
return Image(uiImage: uiImage)
} else {
return nil // No image
}
}
// MARK: - Initializer
init(name: String, ingredients: String = "", steps: String = "", thumbnailData: Data? = nil) {
self.name = name
self.ingredients = ingredients
self.steps = steps
self.thumbnailData = thumbnailData
}
// MARK: - Copy Function
func copy() -> RecipeModel {
RecipeModel(
name: self.name,
ingredients: self.ingredients,
steps: self.steps,
thumbnailData: self.thumbnailData
)
}
// MARK: - Codable Conformance
private enum CodingKeys: String, CodingKey {
case id, name, ingredients, steps, thumbnailData
}
required init(from decoder: Decoder) throws {
...
}
func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id)
try container.encode(name, forKey: .name)
try container.encode(ingredients, forKey: .ingredients)
try container.encode(steps, forKey: .steps)
try container.encode(thumbnailData, forKey: .thumbnailData)
}
}
I want to set the minimum deployment to 16.0, however Xcode (16.2) won't let me select that.
In the drop down box it shows 18,17,16,15, however if any of these is selected it sets them as 18.6, 17.6, 16.6 or 15.6 (see image)
If an attempt is made to edit the value manually, to 16.0, then after change it, Xcode just deletes that value and sets it to nothing.
What's going on here? Why is Xcode only allowing the version other than be something.6 and why will it not let you manually edit it?
I’m working on a project in Xcode 16.2 and encountered an issue where getAPI() with a default implementation in a protocol extension doesn’t show up in autocomplete. Here’s a simplified version of the code:
import Foundation
public protocol Repository {
func getAPI(from url: String?)
}
extension Repository {
public func getAPI(from url: String? = "https://...") {
getAPI(from: url)
}
}
final class _Repository: Repository {
func getAPI(from url: String?) {
// Task...
}
}
let repo: Repository = _Repository()
repo.getAPI( // Autocomplete doesn't suggest getAPI()
I’ve tried the following without success:
• Clean build folder
• Restart Xcode
• Reindexing
Is there something wrong with the code, or is this a known issue with Xcode 16.2? I’d appreciate any insights or suggestions.
Hello!
I am attempting to add Subscriptions to an App that Is already published on the App Store.
I cannot get Xcode to actually sync what is in my App Store Connect.
When adding the Storekit configuration file, I go through the automatic linking process and select the proper bundleID. The configuration file says 'Synced @ [CurrentTime]' however there are no subscriptions listed in there.
I have attempted deleting the file several times, creating a new subscription group. With no success.
Do I need to publish the subscriptions without the features first? Upon attempting to write the supporting code that will enable these features within the app, I cannot get Xcode to identify that I have these subscriptions.
I have also tried pushing these to TestFlight, still with no success.
Thank you.
Hi, since a while now, I've noticed that in Xcode 15 (beta 8), my iOS device running iOS 17 (latest beta), I can't seem to disable the setting "Connect via Network" in the Devices and Simulators window.
The controls are disabled, and stuck to 'on'.
I often also have issues with the 'Installing to device' step while development my apps, where a reboot of the iPad is required. My guess is that it gets stuck/confused how it is supposed to deploy and my network setup is a bit complicated due to VPN's, tight WiFi security etc.
Unpairing the device doesn't help with resetting this setting. After unpairing the top-right header (with the Take Screenshot controls etc...) even still shows the details of the unpaired device.
Anyone else has experienced this or know a solution.
Hello,
Switching Core Data Editor Style has been broken since Xcode 14 Beta 1. Although I can get by, it would be convenient to switch to the Graphical ER diagram style to "visually" study the model for an App.
Regards and Thank You,
John
I've recently set up new M4 Mac Minis with macOS Sequoia and Xcode 16. After logging into my Apple account in Xcode, everything works fine initially. However, the next day—or sometimes just a few hours later—my builds fail, and when I check the Accounts tab in Xcode's Settings, my account is missing. I have to re-add and re-authenticate my account, only for the same issue to recur later.
To investigate further, I upgraded an older Mac Mini from macOS Sonoma and Xcode 15.1.0 to macOS Sequoia and Xcode 16.2. Unfortunately, this machine now exhibits the same behavior, suggesting the issue is related to either macOS Sequoia or Xcode 16.
Has there been a change in Xcode or macOS that causes this automatic removal of accounts? Is there a solution or workaround to prevent Xcode from removing my Apple account?
Any insights or suggestions would be greatly appreciated!
I imported few files in my Xcode project from other projects using drag and drop. Even though the files are copied in the new project and there are no softlinks pointing to the location of other project, the issue is whenever I do a git commit and push, Xcode keeps showing all the projects to commit to rather than just the current project. There seem to be no setting to permanently remove git dependency of other projects. Is there anyway to remove references to other projects?
Why are asynchronous tasks not executed in Xcode Canvas, and why do they only work in the simulator?
Hi everyone, I'm new to Xcode and iOS development. I've encountered an issue where asynchronous tasks seem to not execute in Xcode Canvas, but they work fine in the simulator. Can anyone explain why this might be happening or what I could do to fix it? Thank you for your help!
struct PartnerProfileView: View {
@State private var showSheet: Bool = true
let partnerName: String
var body: some View {
ZStack(alignment: .bottom) {
Color("EFEFF4_0F2534")
ScrollView(showsIndicators: false) {
headerSection()
infoSection()
.padding(.bottom, 5)
sectionTitle("Other Skills")
skillsGrid()
sectionTitle("···")
dynamicsSection()
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
CustomTabBar()
}
.navigationBarHidden(true)
.ignoresSafeArea(edges: .all)
.onAppear {
print("PartnerProfileView received")
Task {
await BottomCustomPopup().present()
}
}
.onChange(of: showSheet) { oldState, newValue in
print("oldState \(oldState)")
print("newValue \(newValue)")
}
}
}
//@MainActor
struct BottomCustomPopup: BottomPopup {
var body: some View {
HStack(spacing: 0) {
Text("Hello World")
Spacer()
Button(action: { Task { await dismissLastPopup() }}) { Text("Dismiss") }
}
.padding(.vertical, 20)
.padding(.leading, 24)
.padding(.trailing, 16)
}
}
I’ve thoroughly checked all configurations, flags, and settings, and I am 100% certain of using the latest stable version of Xcode (16.2, build 16C5032a) with the corresponding SDKs. Despite verifying everything and even trying to deploy using older stable Xcode versions in a VM, I've had no success.
Besides trying other xcode versions, update build numbers, creating new projects, new apps, checking all configs available in xcode, validating certificates and profiles, I've ran out of even what to check, test and try.
Any ideas?
I've contacted Apple already, awaiting response for now.
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
App Store
App Review
App Store Connect
Xcode
I have a developer certificate but not a distribution certificate (its not my Apple account).
Its possible to create an .xcarchive with a developer certificate, but what about a .ipa? After creating an archive, non of the distribution options within XCode will work without a dist cert.
Is there another way to make an .ipa with just a dev cert? And if so is that going to be a dev build rather than a prod build (i.e. the .ipa would only install onto provisioned devices and would be no good for uploading to testflight for example)
Hi Apple developers, I am very new to XCode and Swift, I am planning to build an app for iOS from a web. I tried to use WKWebView to handle the web , I managed to redirect some of the links to Safari, however some button/links didn't trigger .linkActivated function and encounter the error as "Your browser preventing this app to open “URL”.
If I copy the URL to Safari is able to open, I trying to research on web but can't find any related solution for my case.
Here is the code in my app:
import UIKit
import WebKit
import SafariServices
class ViewController: UIViewController, WKNavigationDelegate {
var webView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Initialize WKWebView
let webConfiguration = WKWebViewConfiguration()
//enable javascript
webConfiguration.preferences.javaScriptEnabled = true
webView = WKWebView(frame: self.view.frame, configuration: webConfiguration)
webView.navigationDelegate = self
self.view.addSubview(webView)
// Load a web page as webview
if let url = URL(string: "https://myurl") {
let request = URLRequest(url: url)
webView.load(request)
}
//console log
webView.evaluateJavaScript("console.log('Button clicked!')") { result, error in
if let error = error {
print("Error executing JavaScript: \(error.localizedDescription)")
} else {
print("JavaScript result: \(String(describing: result))")
}
}
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if let url = navigationAction.request.url, navigationAction.navigationType == .linkActivated {
// Check if URL is external and open it in Safari
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
decisionHandler(.cancel) // Prevent loading the link in the WebView
} else {
decisionHandler(.allow) // Allow loading if URL cannot be opened in Safari
}
} else {
decisionHandler(.allow) // Allow the WebView to load the URL normally
}
}
}
I have a very large terminal project that relies on the ncurses library. As of the update on Dec. 11, 2024, the ncurses (and forms) API's no longer work when the app is launched from Xcode. If I run the app by double-clicking on the executable from Finder, the API's work as expected - but of course, that does not allow for debugging - which is the purpose of running within Xcode.
I have tested on a simple project that simply outputs "Hello World" and waits for the input of CR before ending. What should happen, is that "Hello Word" is output on the terminal, but instead no output occurs. I stress that everything worked prior to the update on Dec.11.
The code for main is simply this:
#include <iostream>
#include "stdlib.h"
#include "stdio.h"
#ifdef __cplusplus
#include <iostream>
#endif
#include <cassert>
#include <ncurses.h>
#include <form.h>
using namespace std;
int main(int argc, const char * argv[]) {
// cout << "Hello, World!" << endl;
// Basic test
initscr();
printw("Hello World !!!");
refresh();
int ch = 0;
while (ch != 10) {
ch = getch();
}
endwin();
return 0;
}
To link to libncurses.tbd, in Build Phases, add the libncurses.tbd from the list of Frameworks.
To output on the terminal, select the Product menu item in Xcode, then Edit Schema. Under the Options tab, change the Console selection to Terminal.
When the application runs, the terminal will launch, but no output will occur. I have Googled every topic imaginable for 2 days now but have not come up with a solution. Is there something that I need to update? It looks to me like the libraries have been updated on Dec. 11 as well, but is there something else I need to do?
For a more detailed image of one of the many screens I have working prior to this issue:
We have a big iOS project and we are using .xcconfig files to define our compiler options and build settings.
We have our SWIFT_TREAT_WARNINGS_AS_ERRORS set to YES so that all Swift related warnings will be reported as errors.
Now, we are trying to migrate to Xcode 16.1 and set 'targeted' in the 'Strict Concurrency Checking' flag. This produces some errors that are related to Swift's concurrency checks.
We are now planning to have an approach where we still want to keep SWIFT_TREAT_WARNINGS_AS_ERRORS as is but we want all concurrency related warnings to be still treated as warnings while the rest will get reported as errors.
We found this new compiler option - https://forums.swift.org/t/warnings-as-errors-exceptions/72925.
It looks like the one we want but I think it is still not out yet and we need to wait until Swift 6.1 (correct me if im wrong).
Or is there any other way to do what we want to achieve?
Hey there-
I'm having a quite interesting bug on Swift Playgrounds.
I am trying to run my app with this following code snippet which does not compile on Swift Playgrounds, yet compiles on XCode (note: this is a Swift Playground app)
if #available(iOS 18.0, *) {
//simple function to get the indices of other items that have the same date as the "date" variable
let indices = data!.indices(where: { item in
let sameMonth = Calendar.current.component(.month, from: item.time) == Calendar.current.component(.month, from: date)
let sameYear = Calendar.current.component(.year, from: item.time) == Calendar.current.component(.year, from: date)
let sameDay = Calendar.current.component(.day, from: item.time) == Calendar.current.component(.year, from: date)
return sameDay && sameMonth && sameYear
})
However, the indices(where:) codeblock seems to stop the app from compiling (ONLY on Swift Playgrounds - it works perfectly fine on XCode).
I am getting the following error:
Cannot call value of non-function type 'Range<Array<Int>.Index>' (aka 'Range<Int>')
Please let me know if you have any insight regarding this issue.
-ColoredOwl
Topic:
Programming Languages
SubTopic:
Swift
Tags:
Swift Playground
Xcode
Playground Support
SwiftUI