Views can be viewed on the canvas in XCode via the code below.
#Preview {
ContentView()
}
But how do I preview an App class in XCode?
Background: I'd like to preview various settings done in the Scene of the App.
Xcode
RSS for tagBuild, test, and submit your app using Xcode, Apple's integrated development environment.
Post
Replies
Boosts
Views
Activity
Dear Support Team,
I constantly get a 401 unauthorised error, when I try to add my Developer account in Xcode while running a virutalised macOS using https://developer.apple.com/documentation/virtualization. So I can't use signing, entitlements, etc when building within a virutalised macOS.
The error shown is below:
There was a failure decoding response: (HTTP 401, 60 bytes) The data couldn’t be read because it isn’t in the correct format.
I've found probably the same issue here https://developer.apple.com/forums/thread/759877 Unfortunately, I can't find any updates.
Are you aware of this problem? Are there any planned fixes in upcoming macOS updates?
15.0 (24A335)
Version 16.1 (16B40)
Apple M1 Pro, 16 GB Ram
Best regards, Evgenii
Hi, I am stuck moving one of my projects from Xcode 15 to Xcode 16. This is a SwiftUI application that uses in some places classic Threads and locks/conditions for synchronization. I was hoping that in Swift 5 mode, I could compile and run this app also with Xcode 16 so that I can start migrating it towards Swift 6.
Unfortunately, my application crashes via EXC_BREAKPOINT (code=1, subcode=0x1800eb31c) whenever some blocking operation e.g. condition.wait() or DispatchQueue.main.sync { ... } is invoked from within the same module (I haven't seen this happening for frameworks that use the same code that I linked in dynamically). I have copied an abstraction below that I am using, to give an example of the kind of code I am talking about. I have verified that Swift 5 is used, "strict concurrency checking" is set to "minimal", etc.
I have not found a workaround and thus, I'm curious to hear if others were facing similar challenges? Any hints on how to proceed are welcome.
Thanks,
Matthias
Example abstraction that is used in my app. It's needed because I have synchronous computations that require a large stack. It's crashing whenever condition.wait() is executed.
public final class TaskSerializer: Thread {
/// Condition to synchronize access to `tasks`.
private let condition = NSCondition()
/// The tasks queue.
private var tasks = [() -> Void]()
public init(stackSize: Int = 8_388_608, qos: QualityOfService = .userInitiated) {
super.init()
self.stackSize = stackSize
self.qualityOfService = qos
}
/// Don't call directly; this is the main method of the serializer thread.
public override func main() {
super.main()
while !self.isCancelled {
self.condition.lock()
while self.tasks.isEmpty {
if self.isCancelled {
self.condition.unlock()
return
}
self.condition.wait()
}
let task = self.tasks.removeFirst()
self.condition.unlock()
task()
}
self.condition.lock()
self.tasks.removeAll()
self.condition.unlock()
}
/// Schedule a task in this serializer thread.
public func schedule(task: @escaping () -> Void) {
self.condition.lock()
self.tasks.append(task)
self.condition.signal()
self.condition.unlock()
}
}
Something (or a lot) is janky about apps built for "My Mac - designed for iPad."
Aside from things just not working, the amount of garbage spewed to the console during debugging is unmanageable. I can't see my own trace statements amongst screens and screens of repetitive nonsense.
I right-clicked on it and set it to filter out errors, but I'd like to get notified of legitimate errors. Anyone employing a clever filtering method I'm not aware of?
Despite the recommendation of DTS Engineers at [https://forums.developer.apple.com/forums/thread/766500, Xcode 16.1 ](https://forums.developer.apple.com/forums/thread/766500, Xcode 16.1 ) the same behavior when automatically signing in our CI/CD environment:
The operation couldn’t be completed. Unable to log in with account '<APPLE-ID>'. The login details for account '<APPLE-ID>' were rejected.
error: No profiles for '<BUNDLE-ID>' were found: Xcode couldn't find any iOS App Development provisioning profiles matching '<BUNDLE-ID>'
** ARCHIVE FAILED **
In addition, we see several orphaned Xcode username entries in the local keychain / Keychain Access app that match the identifier stored in com.apple.dt.Xcode.plist under the key DVTDeveloperAccountManagerAppleIDLists - IDE.Identifiers.Prod.
(Preferences read com.apple.dt.Xcode DVTDeveloperAccountManagerAppleIDLists)
or we see that the DeveloperID stored in Xcode - Settings - Accounts is lost.
We have reset a Mac mini (2023 / arm) to factory settings, reinstalled Sequoia in the current version and installed Xcode 16.1 (16B40). Nevertheless, we see the behavior described above. This behavior is not reproducible for us.
We have opened the following tickets, but have not received a response that explains the behavior or offers a solution.
Case ID: 9935876
Feedback: FB15700530
I have a SwiftUI app that I've been working on in XCode 16.1. The project builds and runs in the simulators, on my mac and on my iPhone/iPad without any issues. I'm also able to build my unit test project and run them without any errors. The project has zero warnings in it.
When I go to the Edit Schemes options and change the Run scheme to be a Release build with the Debug Executable unchecked I get a compiler error:
Command SwiftCompile failed with a nonzero exit code
I've attempted this Release Run with the following target devices in XCode:
My iPhone 15 Pro Max (iOS 18.2 Beta 3)
MacBook Air (M1) (15.2 Beta)
iPhone 16 Simulator (iOS 18.1)
Any iOS Simulator Device (arm64, x86_64)
All 3 of these target have the same issue. Normally I would just debug the error from the logs but when I look at the build output I can't see any information in the log to tell me what happened. It looks like the source files are sent into the SwiftCompiler and the compiler fails without bubbling up the issue.
I've provided the full error log export as a Gist HERE due to it's size. Is there anything in the log I'm missing? Is there a way for me to turn on more verbose logging during compilation of a Release Build?
I created a brand new Multiplatform App in XCode and I added all of my source files to it. No project configuration settings were changed. I could build it successfully with the debug configuration. I then changed it to the Release configuration and experienced the same error. I can create another fresh project and make the same release configuration with none of my source files in it and get a successful build. I
t seems there is something wrong with my source files and the release configuration but the compiler doesn't indicate what. I'm lost at this point as I can't figure out how to get a release build and can't seem to find any indication as to why.
Hi there -
I maintain the react-native-apple-authentication module which allows react native developers to implement sign in with Apple
When testing we noticed that code working perfectly in iOS17 Simulators now fails on iOS18/18.1 Simulators. Specifically, the credential status is always revoked when testing on an iOS18+ Simulator.
The same code works perfectly on a real device running iOS18 or 18.1 so this appears to be a Simulator bug.
This is problematic because App review is frequently performed on a Simulator, so there are false-negative test results for Sign In With Apple from reviewers when they use iOS18 emulators, resulting in App submission rejections.
We're tracking this here, with some results posted and an example app in-repo that demonstrates the issue:
https://github.com/invertase/react-native-apple-authentication/issues/356
It would be great to see the Simulator fixed so that it works correctly with Sign In With Apple again. Thanks
I'm working with a MacMini M1 running Sequoia 15.1 OS, and I've configured a Virtual Machine on this device using the Virtualization.Framework to operate with the same OS version.
While I can sign into my account through System Settings without any problems, I encounter difficulties when trying to add my account to Xcode 16.2. Initially, the login appears to succeed, but Xcode quickly presents a "Decoding Error":
There was an issue decoding the response: (HTTP 401, 60 bytes) The data couldn’t be read because it is not in the correct format. As a result, I'm unable to access any account details or team information.
I found a similar issue but I don't think it was resolved, even if it's marked as such:
https://developer.apple.com/forums/thread/767673
Is there an existing workaround?
I’m trying to add my account to Xcode 16.1, which is running on a virtual machine with macOS Sequoia 15.1. I was able to successfully sign in to my account on the virtual machine itself.
I’m using a Mac Mini M2, but when I attempt to add my account in Xcode, I encounter the following error:
"There was a failure decoding response: (HTTP 401, 60 bytes) The data couldn’t be read because it isn’t in the correct format."
I have setup a sandbox user and I'm unable to reset the purchase history - neither by using the functionality in AppStoreConnect nor in the settings of the AppStore-App on the respective devices. Even logout of the sandbox-user in the AppStoreApp and login again didn't help. How can this be fixed? Thanks for your support.
I’m currently trying to localize one of my Mac apps for Right-to-Left languages.
In Xcode, to test this, I set the language to ‘Arabic’ in the scheme, which then displays the language and mirrors the layout accordingly.
I have two questions about this:
macOS titlebar buttons: In the title bar at the top, shouldn’t the Close and Minimize buttons also be on the right side (mirrored)? How can I test this?
Numerals: My UI still displays Latin numerals (123). I know this is correct in some Arabic-speaking regions, but I’d also like to test cases where Arabic-Indic numerals (١٢٣) are used. Is there a way to configure the scheme to test this?
I recently added a new target for Apple Watch, which works fine on the simulator. However, I wasn't able to run it on real Apple watches.
First, I don't see it in the list of devices, even after I click "trust" and connect to my Mac over charging cable.
Second, I've always used automatic code signing, and everything seems OK here.
Third, I also tried distributing it over TestFlight, but that build doesn't appear in the TF. I restarted my phone and relaunched the TF app.
So, when I install the app to my iPhone over the cable, the watch app doesn't appear on Apple watches. Then, If I go to watch app and install my app manual (I see it at the bottom with the "install" button), it fails with the error "This app cannot be installed because its integrity could not be verified.".
Also, there's an icon on the Apple watch, but it shows the same error when I click it.
I unpaired and paired it again, but it didn't help. Also, I tried another pair of phones, and the same thing happened. I use an AppStore account (not enterprise), and the main app works fine.
Is there a way how to fix it?
Hello - Asking a question that's probably been asked, and maybe a couple more.
I bought a membership yesterday and received the email, I'm assuming it's "approved", but when I log in on developer account it says "PENDING".
I will be the only user on my account. I already have the app, it's been tested by another party and all I need do is make some minor changes. So that's done, now I need to create a "debug or release testing distribution", but when I do that I get this error in xCode. Is this normal...until my status changes from "PENDING" to (guessing) APPROVED?
And one further question. I am the only developer, and this app will only be used by one person as it's specialized for a single purpose. What are the option for that person to install the app? Is there a special section on the app store for such an app?
Thanks,
Gary
I'm trying to develop an app to control HomeKit accessories in a way not available so far in macOS. How can I work around the absence of HomeKit Support for macOS in Xcode 16?
Thanks!
I'm confused by documentation and information I found regarding compatibility between versions of Xcode and macOS.
The site https://developer.apple.com/support/xcode/ is listing "Minimum OS required".
To my understanding it means "this particular version of macOS and all later/newer versions".
Also release notes for Xcode are consistently stating "Xcode xx.x. requires a Mac running macOS yy.yy.y or later."
But I also found statements like " In general, new versions of macOS will not run old versions of Xcode." in this forum, see https://forums.developer.apple.com/forums/thread/760737, which is the opposite to "requires macOS version X or later".
I'm also experiencing issues when trying to run Xcode 12.4 on macOS 14.5 (Sonoma), means XCode is not running.
It would be great if some of Apple Engineers here would shed some light on it :-)
Many thanks in advance!
Cheers,
Elena
I'm on an Intel-based Mac running macOS Sonoma 14.7.1 (23H222) and Xcode Version 16.1 (16B40).
I've created a local StoreKit Configuration File that does not synchronise with App Store Connect and selected it in the Scheme.
I have some products that are consumable in-app purchase and it loads fine as expected when I run the app and I am able to make transactions. It also show up in the Transaction Manager.
After a little while, working on the app, re-running it several times, it stops working. The products do not load the metadata from the StoreKit configuration file.
I also get this error in the console:
Error enumerating unfinished transactions for first transaction listener: Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={AMSStatusCode=0, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <DF5E86B0-0E4A-4982-AF42-FC58FA858C01>.<1>, NSErrorFailingURLKey=http://localhost:51027/inApps/history?guid=F01898465023&reason=initial, _kCFStreamErrorDomainKey=10, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <DF5E86B0-0E4A-4982-AF42-FC58FA858C01>.<1>"
), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=http://localhost:51027/inApps/history?guid=F01898465023&reason=initial, NSUnderlyingError=0x60000038c150 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_kCFStreamErrorDomainKey=10, _kCFStreamErrorCodeKey=-72000, _NSURLErrorNWPathKey_desc=satisfied (Path is satisfied), interface: lo0, _NSURLErrorNWResolutionReportKey_desc=Resolved 0 endpoints in 0ms using unknown from query}}, _kCFStreamErrorCodeKey=-72000}
Restarting the computer resolves the issue but I don't want to restart the computer every single time when it happens and it happens quite soon after a short while.
How can I make sure that it doesn't happen or if it does happen then fix the issue without restarting the computer?
Relaunching Xcode doesn't help and neither does deleting Project Build Data and Indexes.
We have been using a Supervision Identity successfully over the last few years to allow us to Xcode debug on managed devices. Something has changed in the last few months which we are finding it hard to find a consistent solution to. We can't determine whether it's Xcode 15/iOS version related. Behaviour we see documented below
All Macs with the Supervision Identity installed can open the device in Apple Configurator without need for trust acknowledge on the device. Configurator can open and stream the device console.
All problematic devices are also registered as a development device with Apple.
We have hit and miss connectivity in Finder, On failure it indicates that the trust prompt on the device needs to be accepted. No trust prompt is displayed
Developer Mode on the device can't be enabled until we attempt to connect to Xcode
Devices that pair successfully in Xcode do so almost immediately. If a device pairs in Xcode it is also visible in the native macOS Console application
If a device fails to pair in Xcode we get a spinner and the message
"Xcode has already started pairing with 'iPhone-X'. Select Trust on iPhone-X to complete pairing".
The macOS console app reports
"The user has not responded to the pairing request on 'iPhone-X' In neither case is a trust prompt displayed on a device.
We are not able to Xcode pair any managed device running iOS 17.x. This includes devices that were successfully paired on iOS16.x then upgraded
iOS16.x devices that pair with one Mac successfully will not pair with another Mac with the same Supervision Identity installed.
The same behaviour is seen on Ventura and Sonoma Macs
Clearing Trusted Computers in IOS Developer Mode has no effect
None supervised iOS devices pair successfully on iOS 16 and 17
Has anyone else witnessed similar issues and found a work around ?
❌ Undefined symbols for architecture arm64
┌─ Symbol: _CMTimeGetSeconds
└─ Referenced from: -[ImagePickerManager mapVideoToAsset:phAsset:error:] in ImagePickerManager.o
❌ ld: symbol(s) not found for architecture arm64
I am using Xcode16, old React Native.
I don't know why CLANG_CXX_LANGUAGE_STANDARD in Pods is gnu++14 when I pod install locally, but gnu++20 when I pod install with CircleCI
If you need help investigating a crash, please include a crash report in your post. To smooth things along, follow these guidelines:
For information on how to get a crash report, see Acquiring crash reports and diagnostic logs.
Include the whole crash report as a text attachment (click the paperclip icon and then choose Add File). This avoids clogging up the timeline while also preserving the wealth of information in the crash report.
If you’re not able to post your crash report as an attachment, see Can’t Post Crash Report as Attachment below.
If you want to highlight a section of the report, include it in the main body of your post. Put the snippet in a code block so that it renders nicely. To create a code block, add a delimiter line containing triple backquotes before and after the block, or just click the Code Block button.
If possible, post an Apple crash report. Third-party crash reporters are often missing critical information and have general reliability problems (for an explanation as to why, see Implementing Your Own Crash Reporter).
Symbolicate your crash report before posting it. For information on how to do this, see Adding identifiable symbol names to a crash report.
If you need to redact the crash report, do so consistently. Imagine you’re building the WaffleVarnish app whose bundle ID is com.example.wafflevarnish but you want to keep your new waffle varnishing technology secret. Replace WaffleVarnish with WwwwwwVvvvvvv and com.example.wafflevarnish with com.eeeeeee.wwwwwwvvvvvvv. This keeps the text in the crash report aligned while making it possible to distinguish the human-readible name of the app (WaffleVarnish) from the bundle ID (com.example.wafflevarnish).
Finally, for information on how to use a crash report to debug your own problems, see Diagnosing issues using crash reports and device logs.
Can’t Post Crash Report as Attachment
Crash reports have two common extensions: .crash and .ips. If you have an .ips file, please post that [1].
DevForums lets you attach a .crash file but not an .ips file (r. 117468172). To work around this, change the extension to .txt.
If DevForums complains that your crash report “contains sensitive language”, leave it out of your initial post and attach it to a reply. That often avoids this roadblock.
If you still can’t post your crash report, upload it to a file sharing service and include the URL in your post. Post the URL in the clear, per tip 14 in Quinn’s Top Ten DevForums Tips.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Because it’s easy to go from an .ips file to a .crash file. I usually do this by choosing File > Quick Look in the Finder. For more info about these file formats, see this post.
Revision History:
2024-11-21 Added a recommendation to post the .ips format if possible.
2024-05-21 Added some advice regarding the “contains sensitive language” message.
2023-10-25 Added the Can’t Post Crash Report as Attachment section. Made other minor editorial changes.
2021-08-26 First posted.