Post

Replies

Boosts

Views

Activity

Sandbox issues opening SQLite associated/sidecar files
I’ve been having a heckuva time getting macOS (Catalina) to let my app open the associated -wal and -shm files. Googling for answers, it seems macOS should already know about these, but if not, I can create NSIsRelatedItemType additions. But that didn't seem to work for me: Is there something more I need to do? If I put the main SQLite file to open inside the app's container, then SQLite can open the associated files just fine. <?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>CFBundleDevelopmentRegion</key> <string>$(DEVELOPMENT_LANGUAGE)</string> <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeName</key> <string>SQLiteDocument</string> <key>CFBundleTypeRole</key> <string>Editor</string> <key>LSHandlerRank</key> <string>Default</string> <key>LSItemContentTypes</key> <array> <string>org.sqlite.sqlite3</string> </array> <key>NSDocumentClass</key> <string>$(PRODUCT_MODULE_NAME).Document</string> </dict> &#9;&#9;<dict> &#9;&#9;&#9;&#9;<key>CFBundleTypeExtensions</key> &#9;&#9;&#9;&#9;<array> &#9;&#9;&#9;&#9;&#9;&#9;<string>sqlite-shm</string> &#9;&#9;&#9;&#9;&#9;&#9;<string>sqlite-wal</string> &#9;&#9;&#9;&#9;&#9;&#9;<string>sqlite-journal</string> &#9;&#9;&#9;&#9;</array> &#9;&#9;&#9;&#9;<key>CFBundleTypeName</key> &#9;&#9;&#9;&#9;<string>Support Type</string> &#9;&#9;&#9;&#9;<key>CFBundleTypeRole</key> &#9;&#9;&#9;&#9;<string>Editor</string> &#9;&#9;&#9;&#9;<key>NSIsRelatedItemType</key> &#9;&#9;&#9;&#9;<true/> &#9;&#9;</dict> </array> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIconFile</key> <string></string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>$(PRODUCT_NAME)</string> <key>CFBundlePackageType</key> <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> <key>CFBundleShortVersionString</key> <string>1.0</string> <key>CFBundleVersion</key> <string>1</string> <key>LSMinimumSystemVersion</key> <string>$(MACOSX_DEPLOYMENT_TARGET)</string> <key>NSMainStoryboardFile</key> <string>Main</string> <key>NSPrincipalClass</key> <string>NSApplication</string> <key>UTExportedTypeDeclarations</key> <array> <dict> <key>UTTypeConformsTo</key> <array> <string>public.database</string> <string>public.data</string> </array> <key>UTTypeDescription</key> <string>SQLite3</string> <key>UTTypeIcons</key> <dict/> <key>UTTypeIdentifier</key> <string>org.sqlite.sqlite3</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>sqlite</string> </array> </dict> </dict> </array> <key>UTImportedTypeDeclarations</key> <array> <dict> <key>UTTypeConformsTo</key> <array> <string>public.database</string> <string>public.data</string> </array> <key>UTTypeDescription</key> <string>SQLite3</string> <key>UTTypeIcons</key> <dict/> <key>UTTypeIdentifier</key> <string>org.sqlite.sqlite3</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>sqlite</string> </array> </dict> </dict> </array> </dict> </plist>
0
0
553
Jan ’21
Encoding UTF-16LE character for USB Product String/Display in USBProber
I'm developing a little USB device for use with macOS, and the name includes the non-ASCII character ū: LATIN SMALL LETTER U WITH MACRON Unicode: U+016B, UTF-8: C5 AB My source file is UTF-8 encoded, but as I understand it, USB uses UTF-16LE encoding for all its strings. GCC (which I'm using to compile the code for the device) doesn't implement the \u unicode point escape. So I tried "productname\xc5\xab", which causes USB Prober to report the Product String as "productname\u016b". Is that just USB Prober not properly rendering the string? Or am I still not encoding it correctly?
0
0
845
Jan ’21
Implementing a complex vector art app in SwiftUI (macOS)?
For years I've poked at a little personal project, an electronic schematic capture app. It's basically a specialized version of something like Illustrator or Omnigraffle, in that you create graphical objects from primitives, instantiate them onto the canvas, and connect them with polylines. I'm very new to SwiftUI, but I'm wondering if it makes sense to build a new custom view to handle drawing this canvas as a "native" SwiftUI view. I know it's possible to wrap NSViews in SwiftUI, but if SwiftUI can handle it, I'd like to just reimplement it. There are a number of requirements that complicate things: This view lives inside a scroll view (or at least, it has bounds that usually extend beyond the window). The view contains custom graphics and text. Some graphical elements span large portions of the canvas (e.g. the poly lines connecting components). The number of individual elements can be quite high (performance concerns). Quadtrees are often used to help with this. It zooms Marquee-selection Mouse down, drag, and up changes the model in significant and varied ways. Hovering can change appearance of some items. Can SwiftUI handle all this? I tried to find an example or documentation, but was not having much luck. Almost everything is iOS-focused, so precise and nuanced mouse handling is uncommon.
0
0
481
Jan ’21
Best practices for displaying very large images (macOS SwiftUI)
I’m writing an app that, among other things, displays very large images (e.g. 106,694 x 53,347 pixels). These are GeoTIFF images, in this case containing digital elevation data for a whole planet. I will eventually need to be able to draw polygons on the displayed image. There was a time when one would use CATiledLayer, but I wonder what is best today. I started this app in Swift/Cocoa, but I'm toying with the idea of starting over in SwiftUI (my biggest hesitation is that I have yet to upgrade to Big Sur). The image data I have is in strips, with an integral number of image rows per strip. Strips are not guaranteed to be contiguous in the file. Pixel formats vary, but in the motivating use case are 16 bits per pixel, with the values signifying meters. As a first approximation, I can simply display these values in a 16 bpp grayscale image. Is the right thing to do to set up a CoreImage pipeline? As I understand it that should give me some automatic memory management, right? I’m hoping to find out the best approach before I spend a lot of time going down the wrong path.
0
0
677
Apr ’21
Adjusting L16 pixel format values in custom CIFilter/CIKernel
Is there documentation describing the semantics of a Metal CIKernel function? I have image data where each pixel is a signed 16-bit integer. I need to convert that into any number of color values, starting with a simple shift from signed to unsigned (e.g. the data in one image ranges from about -8,000 to +20,000, and I want to simply add 8,000 to each pixel's value). I've got a basic filter working, but it treats the pixel values as floating point, I think. I've tried using both sample_t and sample_h types in my kernel, and simple arithmetic: extern "C" coreimage::sample_h heightShader(coreimage::sample_h inS, coreimage::destination inDest) { coreimage::sample_h r = inS + 0.1; return r; } This has an effect, but I don't really know what's in inS. Is it a vector of four float16? What are the minimum and maximum values? They seem to be clamped to 1.0 (and perhaps -1.0). Well, I’ve told CI that my input image is CIFormat.L16, which is 16-bit luminance, so I imagine it's interpreting the bits as unsigned? Anyway, where is this documented, if anywhere (the correspondence between input image pixel format and the actual values that get passed to a filter kernel)? Is there a type that lets me work on the integer values? This document - https://developer.apple.com/metal/MetalCIKLReference6.pdf implies that I can only work with floating-point values. But it doesn't tell me how they're mapped. Any help would be appreciated. Thanks.
0
0
646
Apr ’21
SwiftUI macOS app show new document on launch
As of 11.3, DocumentGroup defaults to showing the open panel (From the release notes: "DocumentGroup apps now show an Open panel on launch, even when iCloud isn’t in use. (66446310).") Seems like it was considered a bug before that it didn't. Thing is, I don't like this behavior and don't want it, especially while I'm working on my app. I want to automatically create a new document. Is there any way to set that?
0
0
470
Apr ’21
SwiftUI previews fail with
As in the locked question here - https://developer.apple.com/forums/thread/674534, I'm constantly running into this error: Compiling failed: 'main' attribute cannot be used in a module that contains top-level code Once it starts, it's not clear how to stop it. No changes were made to my AppDelegate (It's a mostly-UIKit app that I'm adding some SwiftUI views to). It compiles just fine with a regular build, but the SwiftUI preview can't build it. This is proving to be a real hindrance. I can sometimes clear the condition by cleaning build and test results, and relaunching Xcode. But not always. I filed FB9104575 and included the diagnostics.
0
0
606
May ’21
Xcode 13 templates don't add built products to navigator
I just created a new macOS app project in Xcode 13 beta. SwiftUI, unit tests, no Core Data. I just noticed that it does not add the traditional "Products/MyApp.app" group and file, and I can't figure out how to add those via the UI. At least one solution online edits the pbxproj file directly; I'd rather not do that. Is there any sanctioned way to add this? Is not having it a bug?
0
0
584
Jun ’21
AppStoreConnect app icon won't show
I recently created a new app record in AppStoreConnect. The app is still in development and testing, so we use this for TestFlight builds. The app has a complete app icon internally, and shows up in the Simulator and devices correctly. But in AppStoreConnect, it shows the generic app icon placeholder. I contacted Apple support about this, and they told me I needed to include the app icon in the app. I told them I already do, and showed them the screenshots. They basically said sorry, not my problem, try the dev forums. So here I am.
0
0
727
Jun ’21
How to be a web browser on macOS?
Is there a way I can set my own app to be the default web browser on macOS? The System Preferences->General UI for choosing the default web browser doesn't have an obvious way to set an arbitrary app. Is there a way to configure my app so that macOS recognizes it as an option for this list?
0
1
443
Jan ’22
Customizing option-close Window in SwiftUI?
I have a SwiftUI app made up of two types of window. If I hold the option key while clicking in the close box of one window, it closes all the app windows. I want to change that behavior to just close all the windows of a particular type (or use any other criteria, for that matter). Is this even possible?
0
0
428
Feb ’23
Previewing macOS Settings view?
I'm using Settings to implement the preferences in macOS, with a TabView. Runs fine, but in Xcode preview, it renders the buttons differently. Clearly Settings is applying some kind of button style (or TabView knows it needs to change), but how can I get this to work in a preview? I can't preview Settings directly.
0
0
502
Feb ’23