when opening Main.storyboard, all screens turn black, XCode freezes, and then closes. I am adding the font according to this guide. I'm trying to add Inter-VariableFont_opsz,wght.ttf of the https://fonts.google.com/specimen/Inter
Xcode
RSS for tagBuild, test, and submit your app using Xcode, Apple's integrated development environment.
Post
Replies
Boosts
Views
Activity
xCode 16.2 deletes the dev account ...
Steps:
Open the xCode 16.2 (16C5032a)
Open xCode -> Settings -> Accounts
Make sure there are no accounts added
Add some dev account using an AppleID
Make sure the added account is presented in the accounts list
Exit xCode and re-launch it
Open xCode -> Settings -> Accounts
Check the list of dev accounts ...
Actual results:
The list of accounts is empty, and the "No accounts" text is presented.
Expected result:
The previously added account is in service
I am experiencing an issue with Xcode 16.2 (15E204a) where global workspace search does not return results from .xib files.
I am trying to test this simulated Error.
The issue is, I can't get this to trigger through the simulatedError function.
Error will always end up as an unknown error
Example code snippet:
@available(iOS 17.0, *)
func testPurchase_InvalidQuantity() async throws {
// Arrange
testSession.clearTransactions()
testSession.resetToDefaultState()
let productID = "consumable_1"
try await testSession.setSimulatedError(.purchase(.invalidQuantity), forAPI: .purchase)
guard let product = await fetchProduct(identifier: productID) else {
XCTFail("Failed to fetch test product")
return
}
let option = Product.PurchaseOption.quantity(4)
let result = await manager.purchase(product: product, options: option)
switch result {
case .success:
XCTFail("Expected failure due to invalid quantity")
case .failure(let error):
print("Received error: \(error.localizedDescription)")
switch error {
case .purchaseError(let purchaseError):
XCTAssertEqual(purchaseError.code, StoreKitPurchaseError.invalidQuantity.code)
default:
XCTFail("Unexpected error: \(error)")
}
}
}
In the above code snippet, I have an Unexpected Error.
But if i remove try await testSession.setSimulatedError(.purchase(.invalidQuantity), forAPI: .purchase) I will receive a XCTFail in the success of my result.
So when I set the quantity to a -1, only then can I correctly receive an invalidQuantity.
Does anyone know why the try await testSession.setSimulatedError(.purchase(.invalidQuantity), forAPI: .purchase) would fail to work as directed? I have tests for all the generic errors for loadProducts API and the simulatedError works great for them
Today after I apparently fat fingered/misclicked/misdragged something in Xcode, the short cut for "Reveal in Project Navigator" (cmd+shift+J) stopped working for me. I don't have any custom shortcut bindings and the other shortcuts still work, as far as I can tell.
I've deleted and re-installed Xcode; I've run defaults delete com.apple.dt.Xcode to no avail. I'd really like this shortcut back as it's probably my second or third most used one :(
Hello!
When trying to use MLTensor, I am getting the error that it is not found in scope even though I am using Xcode 15.1 (it says fully up to date) and set my deployment target to iOS 17.2. Is there something else I need to be doing in order to use MLTensor?
Thanks!
Michael
Hi everyone,
I am experiencing an issue where I am unable to sign in to my Apple ID within Xcode. Even after updating my password and ensuring that all my credentials are correct, I continue to receive an "Incorrect username or password" error. However, I can successfully log in to Apple Developer Portal, iCloud, and Apple ID settings using the same credentials.
Steps I've Taken to Resolve the Issue:
Updated Software
I have updated macOS Sequoia and Xcode to the latest versions.
I have also verified that my Apple Developer certificates are up to date.
Tried Resetting Authentication in macOS
I removed all related entries for Xcode, Apple ID, and Developer from Keychain Access.
Logged out of my Apple ID from System Settings and restarted my Mac.
Logged back in and retried signing in to Xcode.
Checked Authentication & Security Settings
I verified that two-factor authentication (2FA) is enabled.
Tried appending the verification code directly to the password when logging into Xcode.
Checked Xcode Developer Directory
Ran sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Verified using xcode-select -p, which correctly pointed to the Xcode Developer directory.
Tried Resetting Developer Tools
Removed and reinstalled Command Line Tools (xcode-select --install).
Accepted the Xcode license agreement (sudo xcodebuild -license).
Reinstalled Xcode
Completely uninstalled Xcode using sudo rm -rf /Applications/Xcode.app and reinstalled it from the Mac App Store.
Problem Summary:
Xcode does not recognize my Apple ID credentials, despite them being correct.
I can successfully log in to Apple’s web services, but not to Xcode.
I have already attempted multiple fixes, including resetting keychain entries, reinstalling Xcode, and verifying system configurations.
I would appreciate your guidance on resolving this issue, as I need access to my Apple Developer account within Xcode to continue working on my app.
Thank you for your support.
What I want?
I expect to use xcrun devicectl device process launch --device <uuid> <bundle-identifier> --payload-url <URL> to launch my app and pass the specified URL as I usually do in iPhone.
What I do?
Let's say the app A which I'm developing.
I try to use UIApplication.open(:options:completionHandler:) in another app to open the app A with registered schema. And whether app A is cold launch or background resumption, app A can go foreground with receiving URL.
If I use xcrun devicectl as above described, app A can still be opened. However, app A can't receive URL which I pass through --payload-url option. That's different from in iOS.
BTW: I as well try YouTube with UIApplication.open and xcrun devicectl, the former way work, the latter way not work.
I have used XCode for decades as my default C/C++ programming IDE. I write code that I run locally on my Mac, via "Sign to run locally". Typically this has always "just worked".
I am now using MacOS 14.7 Sonoma, and I suddenly find I cannot run my code projects because I cannot dynamically load unsigned libraries.
"not valid for use in process: library load disallowed by system policy"
BUT - it appears that to allow my local MacOS code to bypass this requires I have a bundle identifier to modify entitlements. Which in turn requires a developer account which I don't have.
Is this all correct? Is there any way to have code run locally and use dynamic libraries as I've done previously? Any advice is much appreciated.
Hello Apple Developer Community,
I recently created a fresh project with:
No dependencies
No additional written code
After generating the iOS build, I navigated to the build folder:"build/ios/iphoneos/Runner.app"
Then, I ran the following otool commands to inspect the binary:
otool -Iv Runner | grep -w _strlen
otool -Iv Runner | grep -w _malloc
Surprisingly, I received positive results, meaning these functions are present in the binary.
My Questions:
Why is a fresh project (with no extra dependencies & No additional written code) including these APIs in the binary?
I am currently developing a No-Sandbox application.
What I want to achieve is to use AuthorizationCopyRights in a No-Sandbox application to elevate to root, then register SMAppService.daemon after elevation, and finally call the registered daemon from within the No-Sandbox application.
Implementation Details
Here is the Plist that I am registering with SMAppService:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.agent</string>
<key>BundleProgram</key>
<string>/usr/local/bin/test</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/test</string>
<string>login</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Code that successfully performs privilege escalation (a helper tool popup appears)
private func registerSMAppServiceDaemon() -> Bool {
let service = SMAppService.daemon(plistName: "com.example.plist")
do {
try service.register()
print("Successfully registered \(service)")
return true
} catch {
print("Unable to register \(error)")
return false
}
}
private func levelUpRoot() -> Bool {
var authRef: AuthorizationRef?
let status = AuthorizationCreate(nil, nil, [], &authRef)
if status != errAuthorizationSuccess {
return false
}
let rightName = kSMRightBlessPrivilegedHelper
return rightName.withCString { cStringName -> Bool in
var authItem = AuthorizationItem(
name: cStringName,
valueLength: 0,
value: nil,
flags: 0
)
return withUnsafeMutablePointer(to: &authItem) { authItemPointer -> Bool in
var authRights = AuthorizationRights(count: 1, items: authItemPointer)
let authFlags: AuthorizationFlags = [.interactionAllowed, .preAuthorize, .extendRights]
let status = AuthorizationCopyRights(authRef!, &authRights, nil, authFlags, nil)
if status == errAuthorizationSuccess {
if !registerSMAppServiceDaemon() {
return false
}
return true
}
return false
}
}
}
Error Details
Unable to register Error Domain=SMAppServiceErrorDomain Code=1 "Operation not permitted" UserInfo={NSLocalizedFailureReason=Operation not permitted}
The likely cause of this error is that /usr/local/bin/test is being bundled.
However, based on my understanding, since this is a non-sandboxed application, the binary should be accessible as long as it is run as root.
Trying
post as mentioned in the response, placing the test binary under Contents/Resources/ allows SMAppService to successfully register it. However, executing the binary results in a different error.
Here is the plist at that time.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.agent</string>
<key>BundleProgram</key>
<string>Contents/Resources/test</string>
<key>ProgramArguments</key>
<array>
<string>Contents/Resources/test</string>
<string>login</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Here is the function at that time.
private func executeBin() {
let bundle = Bundle.main
if let binaryPath = bundle.path(forResource: "test", ofType: nil) {
print(binaryPath)
let task = Process()
task.executableURL = URL(fileURLWithPath: binaryPath)
task.arguments = ["login"]
let pipe = Pipe()
task.standardOutput = pipe
task.standardError = pipe
do {
try task.run()
let outputData = pipe.fileHandleForReading.readDataToEndOfFile()
if let output = String(data: outputData, encoding: .utf8) {
print("Binary output: \(output)")
}
task.waitUntilExit()
if task.terminationStatus == 0 {
print("Binary executed successfully")
} else {
print("Binary execution failed with status: \(task.terminationStatus)")
}
} catch {
print("Error executing binary: \(error)")
}
} else {
print("Binary not found in the app bundle")
}
}
Executed After Error
Binary output:
Binary execution failed with status: 5
Are there any other ways to execute a specific binary as root when using AuthorizationCopyRights?
For example, by preparing a Helper Tool?
I'm currently writing a macro which outputs Swift Testing code:
// Macro code ...
@MainActor
@SnapshotSuite
struct MySuite {
func makeView() -> some View {
Text("a view")
}
}
which expands to...
// Expanded macro code ...
@MainActor
@Suite
struct _GeneratedSnapshotSuite {
@MainActor
@Test(.tags(.snapshots))
func assertSnapshotMakeView() async throws {
let generator = SnapshotGenerator(
testName: "makeView",
traits: [
.theme(.all),
.sizes(devices: .iPhoneX, fitting: .widthAndHeight),
.record(false),
],
configuration: .none,
makeValue: {
MySuite().makeView()
},
fileID: #fileID,
filePath: #filePath,
line: 108,
column: 5
)
await __assertSnapshot(generator: generator)
}
}
In short, this macro creates snapshot tests from a function.
This all works but I'm finding a couple of limitations, potentially with how Macros are expanded in Swift.
Xcode diamonds are not visible
The snapshots tag isn't discovered
There are a couple of things worth noting though:
The suites and tests are discovered in Xcode's Test Navigator each time Xcode runs tests (cmd + u) - although they need to rerun to be updated.
I manually add a @Suite in my code as well as my @SnapshotSuite to all of the suites.
(The tags never seem to be available though)
Couple of questions on this:
Is this a known issue?
Are there any workarounds?
I do wonder if there's a workaround for showing the diamonds with XCTest APIs such as:
https://github.com/swiftlang/swift-corelibs-xctest/tree/main
https://developer.apple.com/documentation/xctest
Hello Apple Developer Community,
I recently created a fresh project with:
No dependencies
No additional written code
After generating the iOS build, I navigated to the build folder:
cd build/ios/iphoneos/Runner.app
Then, I ran the following commands to inspect the binary:
otool -Iv Runner | grep -w _strlen
otool -Iv Runner | grep -w _malloc
Surprisingly, I received positive results, meaning these functions are present in the binary.
My Questions:
Why is a fresh Flutter project (with no extra dependencies) including these APIs in the binary?
How to prevent Xcode from repeatedly attempting to reinstall platform component support packages? Could this be related to certificate issues or assertion failures? etc
All is fine in Xcode15, no LLDB errors whatsoever, but in Xcode16 I can't get any variable displayed in the console because of the following error:
error: type for self cannot be reconstructed: type for typename "$......." was not found (cached)
error: Couldn't realize Swift AST type of self. Hint: using `v` to directly inspect variables and fields may still work.
I've checked the output of swift-healthcheck and there are several messages like this:
SwiftASTContextForExpressions(module: "ROA", cu: "ROA+ViewLayer.swift")::LoadOneModule() -- Missing Swift module or Clang module found for "UIKit", "imported" via SwiftDWARFImporterDelegate. Hint: Register Swift modules with the linker using -add_ast_path.
I added -add_ast_path to the OTHER_LDFLAGS in the faulty module's build settings but no luck.
How can I debug my project in Xcode16?
I can use devicectl to copy single files from a device fine using:
xcrun devicectl --verbose device copy from --user mobile --domain-identifier <BUNDLE_ID> --domain-type appDataContainer --device <DEVICE_ID> --source Documents/Screenshots/0001.png --destination Screeshots/0001.png
but when there are many files this can get pretty slow.
Is there a way of recursively copying an entire directory? I've tried this:
xcrun devicectl --verbose device copy from --user mobile --domain-identifier <BUNDLE_ID> --domain-type appDataContainer --device <DEVICE_ID> --source Documents/Screenshots --destination Screeshots
but nothing is transferred and it times out eventually with the error:
ERROR: The specified file could not be transferred. (com.apple.dt.CoreDeviceError error 7000 (0x1B58))
ERROR: The operation couldn’t be completed. The file service client failed to read data from the network socket because we timed out when waiting for data to become available. (NSPOSIXErrorDomain error 60 (0x3C))
NSLocalizedFailureReason = The file service client failed to read data from the network socket because we timed out when waiting for data to become available.
Xcode itself can do it with the "download container..." option, but I'd like to be able to automate it.
I have had content blockers in the Mac App Store for years. Ever since moving to Sonoma, doing a clean build or archive in XCode deletes the extension from Safari settings since it never gets into the built app. The only way for me to get it back is to remove the DerivedData and target, reboot, and create a target with a different name. That works and stays around in Safari settings as long as I only build and don't clean. However, a clean or an archive removes it again.
Restoring a version of the project from Time Machine that was posted to the App Store weeks or months ago doesn't work. However I can download the version of the app in the App Store, and it works, but I can't build it now from the source code that was used to build that version without going through the above process. Moving from Sonoma 14.7.1 to 14.7.2 didn't work. I would move to Sequoia if I had reason to believe that would work, but I don't.
Safari 18.2, Sonoma 14.7.2, 32GB, 2.2 GHz 6-Core Intel Core i7
I'm pretty new on this platform and also developing IOS mobile apps. I've been struggling for using the data of the api weather kit apple. I have an acount of apple developer, downloaded the certificate... i follow all the necessaries steps in the portal and also in my project and i keep having this error message when i try to use it. I don't know what else should i do for having working it. I would absolutely appreciate that someone could help me with this. Thank you very much!!!!!
Encountered an error when fetching weather data subset; location=<+41.38268070,+2.17702390> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/3/25, 22:54:03 Central European Standard Time, error=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors 2 Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
Xcode 16 seems to „forget“ a swift package within a subfolder of a root package after restart or shut-down.
I have the following project structure, which also resembles the directory structure on disc:
MyPackage
- Package.swift
- README.md
- Sources
- MyPackage
- Tests
- MyPackageTests
- Tools
- MyGenerator // <- after restart this folder is not visible in the Xcode project navigator
- Package.swift
- Sources
- main.swift
- Tests
MyGenerator is a standalone package which is used during development of MyPackage to generate source code files for MyPackage based on text file input. Essentially an executable target script which I can run within its folder with:
swift run MyGenerator someInputFile.txt
MyPackage does NOT use MyGenerator as a dependency, nor do I want this tool listed as a dependency in MyPackage Package.swift file.
Yet MyGenerator is part of the same Git repo, as it documents the changes to the tool on how to generate source code for MyPackage. Both packages are developed in tandem.
MyGenerator itself defines dependencies in its Package.swift file, which are unrelated to the functionality of MyPackage.
After restart of Xcode or even just a longer shut-down period the MyGenerator subfolder is not visible in the Xcode project navigator, the /Tools folder is empty. I have to manually add the sub package via Add files to "MyPackage" -> Move files to destination every time.
How can I solve that Xcode remembers the sub package unter /Tools?
Edit: I am using Xcode 16.2
Hello everyone, I have the problem at the moment that when I create a new project in a new empty repository, the files are always opened the old project.
I have already deleted all caches and also deleted Xcode 16.2 and reinstalled.
Does anyone of you know the problem?
Best regards
Joerg