Post

Replies

Boosts

Views

Activity

Followed docs for "Local Package", how to add to 2nd project?
I have a couple apps in one git repository. I'd like to have a Swift package in that repo as well, shared by apps. In other words, I don't want a separate repo for the Swift package. I followed the instructions here: https://developer.apple.com/documentation/xcode/organizing-your-code-with-local-packages It seems to work. I can write code like this in my app: import MyLocalPackage func foo() { myLocalPackageFunc() } I notice that the package is not listed under Project > MyApp > Package Dependencies. I don't really care, as long as I can reuse code between apps. But when I try to add this package code to a 2nd app, I'm at a loss. I tried "Add Package Dependencies" and "Add Local", but that creates a different looking setup than the 1st app. The code is browsable in the project navigator. And when I try to build it says "Missing package product 'MyLocalPackage'. The documentation linked above, which I used for the 1st app, does a "New > Package". I don't want a new package. How can I connect the existing one?
0
0
36
May ’25
Important item in Keychain seems to have disappeared (after years)
I had the following code in a program that I used to encrypt some important files. I haven't run it in a few years. It used to work, and now it seems the password is mysteriously gone from my Keychain! The return value is now errSecItemNotFound. I'm upset with myself for not backing up the key/password somewhere else. Is there anywhere this could be hiding? Did Apple move it somewhere? I know they created this "Passwords" app in recent years, but I don't see anything in there with the "account" string I used. I run the app from Xcode, so maybe it is in the "container" data somewhere? I do see keychain files under ~/Library. Maybe there is a way to look through old Time Machine backups. Ug. So stressful. Just looking for pointers on where the data might be, and why it might have disappeared. Unfortunately it was not a "guessable" password, it was a generated 256 bit key, base64 encoded. Perhaps I could crack that with brute force if I'm determined enough... public static func queryGenericPasswordAsString(account: String) throws -> String { let query: [String: Any] = [kSecClass as String: kSecClassGenericPassword, kSecMatchLimit as String: kSecMatchLimitOne, kSecAttrAccount as String: account, kSecReturnAttributes as String: true, kSecReturnData as String: true] var item: CFTypeRef? let status = SecItemCopyMatching(query as CFDictionary, &item) guard status != errSecItemNotFound else { throw KeychainError.noPassword } ... }
8
0
288
Mar ’25
Full Disk Access, Run and Debug from Xcode?
I'm working on a macOS app that I want to give "Full Disk Access". When I run from Xcode, I get "permission denied" errors when reading a file in my home directory. What can I do so that I can run and debug from Xcode? I dragged the binary from the derived data folder to the System Preferences list for Full Disk Access, but that seems to do nothing.
5
0
2.9k
Feb ’25
App compiles but "Unable to install" on device
When I try to run my app on my iPhone, from Xcode, I get a popup that says Unable to Install "AppName". There is some text in the popup. Here's the first part of it. (I replaced the real app's name with "AppName".) Anyone know how to fix this? Unable to install "AppName" Domain: com.apple.dt.MobileDeviceErrorDomain Code: -402653103 User Info: { DVTErrorCreationDateKey = "2024-09-28 04:04:29 +0000"; IDERunOperationFailingWorker = IDEInstalliPhoneLauncher; } -- Unable to install "AppName" Domain: com.apple.dt.MobileDeviceErrorDomain Code: -402653103 -- Could not inspect the application package. Domain: com.apple.dt.MobileDeviceErrorDomain Code: -402653103 User Info: { DVTRadarComponentKey = 282703; MobileDeviceErrorCode = "(0xE8000051)"; "com.apple.dtdevicekit.stacktrace" = ( ...
1
0
344
Sep ’24
macOS app icon not updating. Cached?
Hi, If I change the AppIcon in Xcode's Assets.xcassets, and rerun my app, the image used in the dock and app switcher does not update. If I "Clean Build Folder", and re-run, then it updates. This is annoying when I keep tweaking the colors in the icon and want to see how they look. A full rebuild takes a while, because I have a few Swift Package dependencies. Anyone know a trick to get the AppIcon to stop caching (or whatever it's doing)? I tried killall Dock and killall Finder, but that didn't help. (macOS 11.2.3) Rob
5
0
4.3k
Oct ’23
simctl launch --console flag doesn't seem to work?
I created a simple app in Xcode. Installed and ran it in the iOS Simulator. I can also start it from command line like this: % xcrun simctl launch booted com.example.TestBuildCommands --console com.example.TestBuildCommands: 52877 % It just prints that one line and returns my shell prompt. But the help for launch says that --console should: "Block and print the application's stdout and stderr to the current terminal." In my main() function I have: int main(int argc, char * argv[]) { printf("In main.\n"); ... Shouldn't I be seeing that message in my terminal screen? % xcrun simctl help launch Launch an application by identifier on a device. Usage: simctl launch [-w | --wait-for-debugger] [--console|--console-pty] [--stdout=<path>] [--stderr=<path>] [--terminate-running-process] <device> <app bundle identifier> [<argv 1> <argv 2> ... <argv n>] --console Block and print the application's stdout and stderr to the current terminal. Signals received by simctl are passed through to the application. (Cannot be combined with --stdout or --stderr) [...] ps. Anyone know how to turn off syntax highlighting in those triple-backquoted code blocks that are meant to be just terminal text, not highlighted code?
1
1
1.2k
Apr ’23
StoreKit AppStore.sync throws userCancelled when there is no network
I have a button to restore purchases in my app. It calls AppStore.sync() as suggested by sample code. I'm testing in the sandbox, I put my device in airplane mode, and it throws StoreKitError.userCancelled. That's odd. Anyone else see this? I'd like to show an error alert popup to the user here, but I can't differentiate between this an a real userCancelled.
1
1
1.5k
Apr ’23
Getting container files when app not in "Installed App" list in Devices and Simulators window?
I need to get at the files of an app (one that I developed). It's sitting there on the home screen of my iPad, and I can run it. But in the "Devices and Simulators" window in Xcode, in the "Installed Apps" list, it's not there. That list is how I would normally get the "container" so I can see the files. Why would an app that is obviously on the device not be in the list? Is there another way to get the container/files?
0
0
625
Mar ’23
How to save and load MTLTexture, getting back same RGB values?
Hi,I need to save and load metal textures to a file. Example code below is below. I'm noticing the RGB values are changing as it gets saved and reloaded again.metal texture pixel: RGBA: 42,79,12,95after save and reload: 66,88,37,95I thought it might be a colorspace issue, but the colorspaces I’ve tried all had the same problem. `genericRGBLinear` got close, but there’s got to be a way to save the RGB data and get it back exactly. ?thanks,RobCode:// saving... let ciCtx = CIContext() let ciImage = CIImage(mtlTexture: metalTexture, options: [:]) [ … transfrom to flip y-coordinate …] let colorSpace = CGColorSpaceCreateDeviceRGB() let cgImage = ciCtx.createCGImage(ciImage, from: fullRect, format: kCIFormatRGBA8, colorSpace: colorSpace)! let imageDest = CGImageDestinationCreateWithData(mData, kUTTypePNG, 1, nil)! CGImageDestinationAddImage(imageDest, cgImage, nil) CGImageDestinationFinalize(imageDest) // loading... let src = CGImageSourceCreateWithData(imgData, nil) let img = CGImageSourceCreateImageAtIndex(src, 0, nil) let loader = MTKTextureLoader(device: self.metalDevice) let texture = try! loader.newTexture(cgImage: img, options: [:])
8
1
6.7k
Feb ’23
For cursor update events (with NSTrackingArea) how to know if it's coming or going?
I've added an NSTrackingArea to my NSView because I want a certain rectangular area to show a different cursor. As expected, my view gets a call to it's cursorUpdate:(NSEvent*) method, but how do I tell whether it's an "enter" or "leave". - (void)cursorUpdate:(NSEvent *)event { // Do I push or pop my custom NSCursor? } I notice the event.modifierFlags changes from 8 to 9. But I don't see any public enum constants to test that, so I don't know if I can depend on that. The public enum contains stuff like this, in the higher bits. typedef NS_OPTIONS(NSUInteger, NSEventModifierFlags) { NSEventModifierFlagCapsLock = 1 << 16, NSEventModifierFlagShift = 1 << 17, ... The tracking area setup code: NSRect nsRect = ... NSTrackingAreaOptions options = NSTrackingCursorUpdate | NSTrackingActiveInKeyWindow; NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect: nsRect options: options owner: owner userInfo: userInfo]; [myView addTrackingArea: trackingArea];
Topic: UI Frameworks SubTopic: AppKit Tags:
1
0
1.4k
Oct ’22
Images in documentation comments not working?
Does anyone use this? I can't get it working. I'm talking about code in normal swift files, not playgrounds.Example:/// ![testdiagram](/Users/me/fullpathto/test-image.png) /// ![test xcode image](http://devimages.apple.com.edgekey.net/assets/elements/icons/128x128/xcode.png) ///Neither one displays anything in the documentation popover or the Quick Help Inspector.The docs act like it works: https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_markup_formatting_ref/Images.html#//apple_ref/doc/uid/TP40016497-CH17-SW1A lot of my code would really benefit from diagrams in documentation. I'd love to be able to use this.
3
0
1.8k
Oct ’22
Confirm Fix-it by keyboard shortcut? Return key doesn't do it.
Is there a way to quickly confirm a "fix-it" popup using only the keyobard? The "Fix Next Issue" and "Fix Previous Issue" commands just show the popup. I still have to manually press the "Fix" button. Return key simply dismisses the popup. Clicking that tiny button 1000's of times is annoying. Xcode 12.4. In IntelliJ I can fly through these with a nice keyboard shortcut. I'm looking for a similar thing in Xcode.
1
0
1k
Oct ’22