Post

Replies

Boosts

Views

Activity

How do I sign and export a macOS app? Xcode says it can't communicate with Apple
I'm trying to sign and export my macOS app. I do: Archive Distribute App Developer ID -> Export -> Automatically Manage Signing -> FAIL Communication with Apple failed You are not allowed to perform this operation. Please check with one of your Team Admins, or, if you need further assistance, please contact Apple Developer Program Support. https://developer.apple.com/support No profiles for '' were found Xcode couldn't find any Developer ID provisioning profiles matching ''. It should create those for me. I tried to create them via the website, but that ends up making me create a certificate (although it is not clear what kind of certificate). So I do my best to choose the right kind, and then it still doesn't create a profile. I try again, and it says there's no certificate available, so it prompts me to do that again. WHY IS THIS STUFF STILL SO HARD TO DO?
11
0
1.6k
Mar ’23
"Duplicate output file"/"Unable to build node" for localized folders
We have some HTML content embedded in our app. These live in two top-level folders. These folders have been localized, and so live in Resources/en.lproj/HelpContent and Resources/fr.lproj/HelpContent (for example). Similarly, we have a bunch of localized .storyboard files.Xcode 8 builds this just fine. Xcode 9b6 complains:duplicate output file '/Users/me/Library/Developer/Xcode/DerivedData/MyApp- fdskkibuvbsubudkmqtgsjxmyqme/Build/Products/Debug-iphoneos/MyApp.app/ HelpContent' on task: CpResource /Users/me/Projects/Clients/MyCompany/repo/mp_vision/iOS/Controller/MyApp /Resources/fr.lproj/HelpContent /Users/me/Library/Developer/Xcode/DerivedData/MyApp- fdskkibuvbsubudkmqtgsjxmyqme/Build/Products/Debug-iphoneos/MyApp.app/ HelpContent (in target 'MyApp')unable to build node: '/Users/me/Library/Developer/Xcode/DerivedData/MyApp- fdskkibuvbsubudkmqtgsjxmyqme/Build/Products/Debug-iphoneos/MyApp.app/ HelpContent' (node is produced by multiple commands; e.g., 'b1132708c20f997e752faabcee01d49c82a500833121dcd848c3954357d9f7b1: CpResource /Users/me/Projects/Clients/MyCompany/repo/mp_vision/iOS/Controller/MyApp /Resources/en.lproj/HelpContent /Users/me/Library/Developer/Xcode/DerivedData/MyApp- fdskkibuvbsubudkmqtgsjxmyqme/Build/Products/Debug-iphoneos/MyApp.app/ HelpContent' and 'b1132708c20f997e752faabcee01d49c82a500833121dcd848c3954357d9f7b1: CpResource /Users/me/Projects/Clients/MyCompany/repo/mp_vision/iOS/Controller/MyApp /Resources/fr.lproj/HelpContent /Users/me/Library/Developer/Xcode/DerivedData/MyApp- fdskkibuvbsubudkmqtgsjxmyqme/Build/Products/Debug-iphoneos/MyApp.app/ HelpContent')The Files & Groups list shows it correctly (e.g. "HelpContent" with "HelpContent (English)" and "HelpContent (French)" as sub-folders. The folders only show up once in the Copy Bundle Resources phase.But the build stops almost immediately on this error.
12
0
18k
Jan ’22
altool failed upload with Error: Unable to authenticate. (-19209)
altool seemed to be working correctly, but then failed after upload finished: $ xcrun altool --upload-package ../exports/OurApp.ipa --type ios --apple-id <apple-id> --bundle-id <bundle-id> --bundle-version 291 --bundle-short-version-string "3.1.5" --apiKey <api-key> --apiIssuer <issuer> --show-progress Getting list of providers... Beginning delivery... Analyzing package… Requesting app information… Requesting asset description upload id… Sending analysis to the App Store… Waiting for response… Requesting upload instructions from the App Store… Preparing to upload package to the App Store… Uploading package to the App Store… **status code 401, auth issue. *** Error: *** status code 401, auth issue. *** Error: Error uploading '../exports/OurApp.ipa'. *** Error: Unable to authenticate. (-19209) Note that --list-providers seems to work just fine with the same credentials: $ xcrun altool --list-providers --apiKey <key> --apiIssuer <issuer> Getting list of providers... ProviderName ProviderShortname PublicID WWDRTeamID ------------ ----------------- ------------------------------------ ---------- Whatnot Inc. <redacted> <redacted> <redacted> @eskimo?
7
0
3.5k
Apr ’22
Any way to get arbitrary TIFF tags from a file?
It seems that there’s still no way to get all TIFF tags from a TIFF image, is that right? I've got these GeoTIFF images that have a handful of specialized TIFF tags in them. Calling CGImageSourceCopyPropertiesAtIndex(), I can see basic properties common to all TIFF images, like dimensions and color/pixel information, but no others. Short of including libtiff, is there another way to get at the metadata? I've tried all of the options in CGImageSourceCopyAuxiliaryDataInfoAtIndex. I've written a few bugs about this since 2020, all ignored.
6
0
976
Jul ’24
Error when using SecItemAdd with kSecReturnPersistentRef and user presence kSecAttrAccessControl
I'm trying to add a generic password to the keychain and get back the persistent ID for it, and give it .userPresence access control. Unfortunately, if I include that, I get paramError back from SecItemAdd. Here's the code: @discardableResult func set(username: String, hostname: String?, password: String, comment: String? = nil) throws -> PasswordEntry { // Delete any existing matching password… if let existing = try? getEntry(forUsername: username, hostname: hostname) { try deletePassword(withID: existing.id) } // Store the new password… var label = username if let hostname { label = label + "@" + hostname } var item: [String: Any] = [ kSecClass as String : kSecClassGenericPassword, kSecAttrDescription as String : "TermPass Password", kSecAttrGeneric as String : self.bundleID.data(using: .utf8)!, kSecAttrLabel as String : label, kSecAttrAccount as String : username, kSecValueData as String : password.data(using: .utf8)!, kSecReturnData as String : true, kSecReturnPersistentRef as String: true, ] if self.synchronizable { item[kSecAttrSynchronizable as String] = kCFBooleanTrue! } if let hostname { item[kSecAttrService as String] = hostname } if let comment { item[kSecAttrComment as String] = comment } // Apply access control to require the user to prove presence when // retrieving this password… var error: Unmanaged<CFError>? guard let accessControl = SecAccessControlCreateWithFlags(nil, kSecAttrAccessibleWhenUnlockedThisDeviceOnly, .userPresence, &error) else { let cfError = error!.takeUnretainedValue() as Error throw cfError } item[kSecAttrAccessControl as String] = accessControl item[kSecAttrAccessible as String] = kSecAttrAccessibleWhenUnlockedThisDeviceOnly var result: AnyObject! let status = SecItemAdd(item as CFDictionary, &result) try Errors.throwIfError(osstatus: status) load() guard let secItem = result as? [String : Any], let persistentRef = secItem[kSecValuePersistentRef as String] as? Data else { throw Errors.malformedItem } let entry = PasswordEntry(id: persistentRef, username: username, hostname: hostname, password: password, comment: comment) return entry } (Note that I also tried it omitting kSecAttrAccessible, but it had no effect.) This code works fine if I omit setting kSecAttrAccessControl. Any ideas? TIA!
6
0
155
Jul ’25
Invalid argument error from tcsetattr when setting speed to anything other than predefined
I'm trying to communicate with an RS-485 device using a USB-to-RS-485 adapter based on a CP21012N. It's capable of speeds up to 3 Mbaud. However, when I call tcsetattr() with speed set to anything other than one of the predefined constants (using cfsetspeed()), I get an "Invalid argument" error back from the call. Googling, I found https://github.com/avrdudes/avrdude/issues/771 Seems like macOS really can't accept baud rates outside the predefined set without resorting to ioctl?
5
0
1.1k
Jun ’24
SwiftUI macOS: tracking the mouse in a view?
I've got macOS SwiftUI app that displays an image, currently using Image. I need to display information about the pixel under the mouse pointer (its position, color, etc.) in some text fields at the bottom of the window. I can't find an appropriate event handler to attach to Image. Traditionally I would have used mouseEntered, mouseExited, and mouseMoved. These are available for an NSHostingView, but that's for wrapping native views. I found onHover(), which takes the place of mouseEntered and mouseExited, but it neither works (the perform method is never called for me), nor does it provide movement and position.
4
2
7.4k
Aug ’21
Coalescing @Published changes?
I've got the following code that updates a @Published var messages: OrderedSetMessage property: swift public func add(messages inMsgs: [IncomingMessage]) { for msg in inMsgs { let msg = Message(fromIncoming: msg, user: user) self.messages.append(msg) } self.messages.sort() } In my SwiftUI view, however, .onChanged(self.stream.messages) gets called three times each time a single message is added. I tried operating on a local copy of self.messages, and then just setting self.messages = local, but that didn't change anything. Maybe the issue is on the SwftUI side? In any case, how are published updates to a property coalesced?
4
0
1.5k
May ’21
Getting the current queue and thread name?
The Xcode console logs an identifier indicating the current thread that's running when a message is print()ed from Swift. Some more complex logging systems (e.g. swift-log and console-kit) don't provide that information, and I'm trying to write a logging back-end for swift-log that will. Thing is, I don't see any way to get the current queue name in Swift. I tried dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) But I get "cannot convert value of type '()' to expected argument type 'DispatchQueue?'". Passing nil instead results in "'dispatch_queue_get_label' has been replaced by property 'DispatchQueue.label'". This is not an unreasonable thing to want to do, and it poses no safety concerns.
4
0
5.6k
Nov ’22
Running built macOS app in 13.3 beta VM on M1?
I managed to get a macOS 13.3 beta install running in Parallels on my M1 VM, but it was really hard to get my app (built on my 13.2.1 M1 native macOS) installed on it, because so many features are unsupported in the VM (e.g. I can't drop files onto it like I can with other OSes, or on Intel; I can't log in with my Apple ID because Apple doesn't allow that, etc.). I finally copied it over using File Sharing from the VM, but the virtual OS won't launch it. It throws up a vague alert saying "The application can’t be opened." If I try to launch it from the command line, I get The application cannot be opened for an unexpected reason, error=Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x600000f2da10 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}} I assume it's some kind of code signing/gatekeeper issue, but I don't really know. I also tried this using the Apple virtualization framework and sample virtual machine tools (neat that those exist). I'm pretty sure this is exactly what Parallels is using internally, btw. It lacks a LOT. Is there any way to make running macOS betas in a VM a viable way of testing?
4
1
1.5k
Feb ’23
Determining if user has passkey for service already?
I'm working my way through adding passkey support to my app. At app launch, I'd like to test to see if the user has already created a passkey for the service, and if not, immediately present the account creation UI. Is there an API call I can make to see if the user already has a credential? From the examples I’ve found, it seems I should just try to sign in, and I’ll get an error callback if there are no stored credentials. Is that right?
4
0
2.1k
Mar ’24
Printing from a SwiftUI app (on macOS)?
How does one print from a SwiftUI app (on macOS)? Is there any SwiftUI or Swift API for this, or do I just use the old AppKit APIs (https://developer.apple.com/documentation/appkit/printing)? What if I wanted to print from iOS?
Topic: UI Frameworks SubTopic: SwiftUI
4
0
801
Sep ’24
UICloudSharingContainer equivalent on macOS (i.e. SwiftUI)?
I'm trying to write a SwiftUI iOS/macOS app that allows users to collaborate, but I keep running into limitations. The latest is that I can't figure out what the UICloudSharingContainer equivalent is on macOS. It doesn't seem like there’s a SwiftUI version of this, so I have to write a lot of platform-specific code to handle it, but it's not clear what the AppKit equivalent is.
4
0
945
Oct ’24
AXIsProcessTrusted returns true, but AXUIElementCopyAttributeValue fails with .cannotComplete
This was working a few days ago, but it has since stopped and I can't figure out why. I've tried resetting TCC, double-checking my entitlements, restarting, deleting and rebuilding, and nothing works. My app is a sandboxed macOS SwiftUI LSUIElement app that, when invoked, checks to see if the frontmost process is Terminal, then tries to get the frontmost window’s title. func getFrontmostWindowTitle() throws -&gt; String? { let trusted = AXIsProcessTrusted() print("getFrontmostWindowTitle AX trusted: \(trusted)") guard let app = NSWorkspace.shared.frontmostApplication else { return nil } let appElement = AXUIElementCreateApplication(app.processIdentifier) var focusedWindow: AnyObject? let status = AXUIElementCopyAttributeValue(appElement, kAXFocusedWindowAttribute as CFString, &amp;focusedWindow) guard status == .success, let window = focusedWindow else { if status == .cannotComplete { throw Errors.needAccessibilityPermission } return nil } var title: AnyObject? let titleStatus = AXUIElementCopyAttributeValue(window as! AXUIElement, kAXTitleAttribute as CFString, &amp;title) guard titleStatus == .success else { return nil } return title as? String } I recently renamed the app, but the Bundle ID has not yet changed. I have com.apple.security.accessibility set to YES in the Entitlements file (although i had to add it manually), and a NSAccessibilityUsageDescription string set in Info.plist. The first time I ran this, macOS nicely prompted for permission. Now it won't do that, even when I use AXIsProcessTrustedWithOptions() to try to force it. If I use tccutil to reset accessibility and apple events, it still doesn't prompt. If I drag my app from the build products folder to System Settings, it gets added to the system TCC DB (not the user DB). It shows an auth value of 2 for my app: % sudo sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" "SELECT client,auth_value FROM access WHERE service='kTCCServiceAccessibility' OR service='kTCCServiceAppleEvents';" com.latencyzero.&lt;redacted&gt;|2 &lt;redactd&gt; I'm at a loss as to what went wrong. I proved out the concept earlier and it worked, and have since spent a lot of time enhancing and polishing the app, and now things aren't working and I'm starting to worry.
4
0
1k
Jul ’25
Xcode 13 can't fails to prepare device for development after iOS 14.7.1 update
Has anyone else run into this and found a workaround? Xcode 13b1, 3, and 4 are unable to prepare my device for development after I updated it today to 14.7.1. Xcode 12.5.1 is able to. After churning for several minutes, it always ends up saying Failed to prepare device for development. I've rebooted the device and my Mac a few times each now. There's at least one other report of this issue: https://stackoverflow.com/questions/68549513/xcode-doesn-t-support-phone-s-ios-14-7-1
3
0
5.7k
Oct ’21