Post

Replies

Boosts

Views

Activity

Reply to How can I test a QuickLook Preview Extension using Xcode?
I didn't really find anything in Apple docs on how to debug my extension using Xcode (so not saying it doesn't exist). It doesn't exist. I found a current Stack post on it, with several devs all stuck. Gotta love the internet, eh? In 2024 someone said run the Preview Extension, select Finder as the test app, then in a Finder window select a file of the correct type and tap space. It's hard to debug what someone once said. QuickLook has been redesigned a couple of times. Maybe they were still trying one of the old designs. The easiest solution is to write a test rig. I was going to include a preview of folders in my new app, but then decided against it. But the QuickLook test rig will be useful in the future. Here's part of that code: This is view controller for QuickLook: import Cocoa import Quartz class PreviewViewController: NSViewController, QLPreviewingController { @IBOutlet weak var folderController: FolderController! override var nibName: NSNib.Name? { return NSNib.Name("PreviewViewController") } override func loadView() { super.loadView() // Do any additional setup after loading the view. } func preparePreviewOfFile(at url: URL) async throws { folderController.url = url } override func viewDidLayout() { super.viewDidLayout() folderController.updateLayout(frame: view.frame) } } Here's the AppDelegate for my test rig that manually triggers it: import Cocoa import UniformTypeIdentifiers // The application delegate. @main class AppDelegate: NSObject, NSApplicationDelegate { var previewWindow: NSWindow! var previewWindowController: NSWindowController! var previewViewController: PreviewViewController! // The application has finished launching. func applicationDidFinishLaunching(_ aNotification: Notification) { previewWindow = NSWindow( contentRect: NSRect(x: 0, y: 0, width: 800, height: 600), styleMask: [.titled, .closable, .resizable, .miniaturizable], backing: .buffered, defer: false) previewWindow.title = "FolderPreview" previewWindow.center() previewViewController = PreviewViewController() previewWindow.contentViewController = previewViewController previewWindowController = NSWindowController(window: previewWindow) previewWindowController.showWindow(nil) previewWindow.makeKeyAndOrderFront(nil) } // The application is going to quit. func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your application } // Support secure restorable state. func applicationSupportsSecureRestorableState( _ app: NSApplication) -> Bool { return true } } extension PreviewViewController { // Open a document. @IBAction func openDocument(_ sender: Any?) { // Allow opening a folder or directory. var allowedContentTypes = [UTType]() allowedContentTypes.append(UTType.folder) allowedContentTypes.append(UTType.directory) let panel = NSOpenPanel() panel.allowsMultipleSelection = false panel.canChooseDirectories = true panel.allowedContentTypes = allowedContentTypes if panel.runModal() == .OK { if let url = panel.urls.first { self.folderController?.url = url } } } } Assigning the url property is what does all the work. You'll need to change your allowedContentTypes as appropriate. Just run the app and choose File > Open.
Nov ’25
Reply to How to switch in-app-purchases from sandbox to production?
What I don't understand from the reviewer's response is what receipts validation are they talking about? When a user makes a purchase, it creates a receipt in the app bundle. Your app should check the validity of that receipt. If it is valid, then you make the premium features available. If you don't validate the receipt, then hackers will re-distribute your app with a fake receipt so that anyone can use it for free. They might even charge a fee, making money off your app instead of you. Don't assume you're too small to be targeted. I assure you that you're not. I have no payment servers (the whole concept of using Apple's in-app-purchases service is to not have to deal with my own payment implementation) That's something totally different. Most apps are subscription based or have some service provided over the internet. For these use cases, Apple provides a quick-and-easy way to validate receipts. In your case, since you're entirely on-device, you'll need to validate the receipt on-device. That's tricky because your receipt validation logic can (and will) also be hacked. Again, don't assume that hackers won't reverse-engineer your app and change the binary instructions. They will. The reviewer's response is so vague, and so completely deprived of details that I have no idea what to do I'm afraid that the reviewer is assuming that you already know about the issue, but maybe copied code from the internet or an AI. It's not a developer's market. Performing receipt validation on device used to be a Really Big Deal. It isn't such a problem anymore because users have become trained to accept subscriptions. I've tried to give you a little background to explain what's going on. Unfortunately, I have no idea what your problem is. Your app does need to connect to Apple servers to find your in-app purchases and do things like get the region-specific price to be shown to the user. It sounds like your app isn't talking to the production servers. App reviewers test in a hybrid environment where everything is real except the money. The reviewer's note is straightforward. Just substitute "app" for "server" in your case.
Topic: App & System Services SubTopic: StoreKit Tags:
Oct ’25
Reply to Copying files using Finder and Apple Events
The application isn't sandboxed, so I didn't add any additional entitlements and it should not matter. Well there's still the Apple Events capability in "Signing & Capabilities". You have to provide a message to the user about why your app needs AppleEvents. I'm not sure what happens if that's missing. I don't see why I wouldn't use it while it's still there and hasn't been deprecated yet. Just because something hasn't been deprecated doesn't mean that it's reliable. This approach works the same way as when executing AppleScript script with NSUserAppleScriptTask I'm going to go ahead and disagree on that point. But I assume you're only talking about the end result for your use case. I've mentioned in my initial post why such approach isn't working for me in case files with same names already exist at the destination. Are you sure that's even possible? While the Finder is an unusual app, it's still a stand-alone app. Just because it exposes certain functionality via AppleScript doesn't guarantee that said functionality is going to be the same as what the user experiences when interacting directly with the app. There's a strong argument to say that it shouldn't. People who are writing scripts want their script to run in their own UI and logic flow. They generally don't want a service provider to inject its own UI into the process. So I think your suspicions here: I came to suspect that I could achieve such bahaviour by using Apple Events directly are likely unfounded. I don't understand why it's so important to use the Finder. Writing your own conflict resolution UI would be a lot easier than writing anything in AppleScript. I'm aware of Finder's "merge" functionality, but it's really not very good. It's quite difficult to trigger it in the first place. That strongly suggests that it's an artifact of the user's interaction with the Finder's file listing rather than a lower-level, scriptable operation.
Oct ’25
Reply to Copying files using Finder and Apple Events
Any help is highly appreciated, thanks! Have you jumped through all the hoops so that your app can actually send Apple Events? Here is some old documentation that might be a good starting point: https://developer.apple.com/library/archive/qa/qa1888/_index.html And here is a previous question from someone managed to get it working, after a fashion: https://developer.apple.com/forums/thread/771769 Any attempt to script the Finder is going to limit your app. It won't be acceptable for the Mac App Store. Any new code that relies on AppleScript is risky. Apple is already transitioning to Shortcuts. And Apple has begun to be much more aggressive about deprecating and discontinuing technologies, pretty much all of which are much recent than Apple Events. In older apps where I still did such things, I had good success with running the "osascript" command-line tool with carefully constructed parameters.
Oct ’25
Reply to Notarization Incomplete for Github Workflows
However, we are trying our hardest to maintain a unified codebase going forward, so we are very much trying to prioritize finding a way to make the original python build work. That's all well and good. But Apple's priority is obviously Swift apps for iOS. I have no reason to think that the workflow is the source of this issue I didn't say the workflow is the source of the issue. I said the workflow is the easy part. The difficult part will be getting the Python app to run once it's been notarized. That's a significantly different runtime environment. I wasn't able to find any resources in the documentation about the nuances of notarizing python apps. And you won't. You can search this forum for either "python" or any variant of "notarized" and find dozens of posts about notarizing Python apps. Apple Developer support usually tries very hard to help, but it's always painful.
Topic: Code Signing SubTopic: Notarization Tags:
Oct ’25
Reply to Notarization Incomplete for Github Workflows
I am new to the apple developer program...The software is entirely written in python and includes ffmpeg That's probably the single most difficult type of software you can try to build on a Mac. We are currently adding the signing and notarization of the app to our github workflow. Have you tried to do any of this not using a GitHub workflow? Because I hate to tell you this, but most people who experience notarization problems get stuck at a much later stage. You haven't got to the difficult part yet. I would like feedback about if there is a fundamental flaw in our approach for signing and notarizing our application, so that we can identify it. I recommend skipping all the automation stuff until you confirm that your notarized app actually runs. Notarization adds a lot of runtime checks that are particularly difficult for Python apps to pass. I would appreciate some guidelines about how long to expect this notarization step to take until we can get notarization to finish within 10s of minutes, as we have a hard-coded 30 min wait time for the completion of the notarization in our workflow right now. For a native app, notarization usually takes 10 seconds or so. It would be helpful to know how to check our logs, as requesting the logs for any of our attempts results in being told that the logs are not available yet. If the logs aren't available yet, then there's nothing for you to check. I don't know anything about Python apps, other than they seem to generate an inordinate number of problems as reported here in the forums.
Topic: Code Signing SubTopic: Notarization Tags:
Oct ’25
Reply to Is It Still Possible for Indie iOS Apps to Thrive in 2025?
Once, the App Store empowered indie creators - small teams could launch great apps Nothing has changed in that respect. There are more opportunities now for people to build low-quality apps by using low-quality, cross-platform frameworks and tools. But people are still able to launch great apps with discipline, intelligence, and hard work. and find users easily This part has changed. There are lots more apps to choose from, a radically different marketplace, and different user expectations. It now takes more work and more time to find users. But in 2025, that era feels long gone, with algorithms, big players, and pay-to-win discoverability reshaping everything. Many things have changed over the past 17 years. Is there still a real chance for indie iOS developers today, or has Apple’s evolving ecosystem made independent success nearly impossible? Many people are having success. They're just focused on their products and providing a great experience for their customers. Posting content on social media doesn't help with that. That's why you see so much negativity. Negativity and hate, not success, are what drive social media. I think one big difference from 2008 is the idea of "indie". Back then, it generally meant working for yourself instead of working for some larger company. These days, it essentially means someone makes a few hundred dollars from 6 months of work. On social media, people cheer making a billion dollars and making 25. But nobody wants to hear about making a living. It does take more work now. Being a developer isn't enough. One also needs to know how to run a business, advertise, attract customers, and support them. At first, everything was new, and that was easy. Now, people expect Apple to do all that for them. When that doesn't happen, they try cheats and scams, which usually get traction in social media. Avoid the labels and build software that people will value.
Oct ’25
Reply to WebKit HTML Anchor download attribute ignored by PDF files
Never use the "comments" feature to reply. It's a known annoyance with the forum. The comments don't trigger notifications and are hidden. I'm not entirely sure what you're talking about. You've mentioned HTML, WebKit, WebSockets, and PDF. I assumed from the fact that you're posting here and you mentioned WebKit that you're developing an app using WebKit and WKWebView and it isn't handling PDF downloads the way you would like. The solution is to implement one or more of the many WebKit delegate methods to handle these HTML attributes. I don't know offhand what the exact solution is, or even if it's possible. But my guess is that it should be possible. A quick Google search suggests that that's true.
Topic: Safari & Web SubTopic: General Tags:
Oct ’25
Reply to NSOutlineView (Multiple Selection): How to prevent Child Row Deselection on Collapse
You'll have to do that manually. Maybe add a "selected" flag to each item. Then if an item is expanded, then you can instruct it to re-select any items whose "selected" flag was true. Remember that an outline view is just a fancy table view. When you collapse and item, those rows are gone, so it isn't possible to maintain their selection within the table itself.
Topic: UI Frameworks SubTopic: AppKit Tags:
Oct ’25
Reply to How to print WKWebView in Sequoia?
[quote='861567022, JWWalker, /thread/803249?answerId=861567022#861567022, /profile/JWWalker'] No idea what you mean by that? [/quote] It looks like an autocorrection. It should have been "overflow". But that's irrelevant. I was just confused by your GitHub link. It was GitHub that printed properly. Now that I know what you're doing, I can reproduce the problem. It seems clear that it's the dynamic markdown that's causing all the trouble. If you look closely in the print preview, you can see that the top margin on page 1 is wrong. The first element is right up at the top of the page. That throws off the page count because the full print does it properly. I was also able to easily hack up my older app and have it swap out its own data for your markdown-html. The first time I tried it, both the preview and the output came out short, at only 8 pages. But all subsequent attempts worked properly, printing all 13 pages (with my headers). I think WebKit is caching this data. That's why it only fails the first time. When I swapped out the legacy for the new, all I could only ever get was a single page. I think the new renders much faster and that's why it only has a single page at print time. This old app does both the legacy and the new WebKit, so it has a lot of overhead. That explains why I can only get a single page whereas a simple app gets 11. I'm taking care to avoid printing until the document ready event in Javascript. So this markdown parsing must be happening after that. That would explain these results. It simply hasn't finished rendering the page when it gets the page count. And I ran the rendered HTML from Safari through the W3C HTML validator. It's not valid HTML. Like any browser, WebKit tries to compensate. But combined with the Javscript rendering, it seems to be too much for it to handle. Good luck on your bug report. But until that's fixed, I recommend static HTML.
Topic: Safari & Web SubTopic: General Tags:
Oct ’25
Reply to How to print WKWebView in Sequoia?
I was just about to give up and tell you to create a demo project that just opened one web view and printed it. But I thought I should try that first myself. I did and also got 2 blank pages. There are lots and lots of possible options. But in this demo app, here is how I fixed it using a Swift Storyboard document-based app: In Xcode Interface Builder, find the print menu item. Change its sent action from "print:" to "printDocument:" in NSResponder. Observe that the app now prints correctly. I tried this with your sample and got 12 pages, including the last. Nothing seems to be missing except horizontal overview inside a div in the web view, but that's a different problem. I poked around for a bit. It looks like the old XIB templates in Xcode used "printDocument:" as the sent action. For some reason, in the newer Storyboard templates this was changed to just "print:", which doesn't seem to work. No clue about SwiftUI. I have a newer app in Swift that isn't document-based. In this app, I seem to have already changed the print action to "printView:", which I implemented in my view controller. My old Objective-C app uses printDocument, which the XIB template also uses. So this solves your blank page problem with "printView:". This is also complicated by the NSView and NSWindow Objective-C methods "print:" that are re-defined in Swift as "printView:" and "printWindow:". I'm still not sure why you're getting partial output. My demo app uses your code and prints fine. I played around with it a bit, putting the print method in both the view controller and the document. Worked fine either place. Perhaps the demo app would be a good place to start after all.
Topic: Safari & Web SubTopic: General Tags:
Oct ’25
Reply to codesign stubbornly failing
If you run "codesign" on your executable, it tells you exactly what the problem is: /tmp $ codesign -vv -R="anchor apple generic" renderrob.app renderrob.app: unsealed contents present in the root directory of an embedded framework In subcomponent: /private/tmp/renderrob.app/Contents/Frameworks/Python.framework If you explore that framework using Terminal, you'll see what it's complaining about: /tmp $ find /private/tmp/renderrob.app/Contents/Frameworks/Python.framework ... /private/tmp/renderrob.app/Contents/Frameworks/Python.framework/Versions/._Current /private/tmp/renderrob.app/Contents/Frameworks/Python.framework/._Resources /private/tmp/renderrob.app/Contents/Frameworks/Python.framework/._Python Remove those files and try again: /tmp $ rm /private/tmp/renderrob.app/Contents/Frameworks/Python.framework/Versions/._Current /tmp $ rm /private/tmp/renderrob.app/Contents/Frameworks/Python.framework/._Resources /tmp $ rm /private/tmp/renderrob.app/Contents/Frameworks/Python.framework/._Python /tmp $ codesign -vv -R="anchor apple generic" renderrob.app renderrob.app: a sealed resource is missing or invalid file added: /private/tmp/renderrob.app/Contents/Resources/lib/python3.11/._site.pyc file added: /private/tmp/renderrob.app/Contents/Frameworks/._libmpdec.4.dylib Almost there. Keep removing those dot files... /tmp $ rm /private/tmp/renderrob.app/Contents/Resources/lib/python3.11/._site.pyc /tmp $ rm /private/tmp/renderrob.app/Contents/Frameworks/._libmpdec.4.dylib /tmp $ codesign -vv -R="anchor apple generic" renderrob.app renderrob.app: valid on disk renderrob.app: satisfies its Designated Requirement renderrob.app: explicit requirement satisfied Now you're good to go. Or at least, ready to notarize. Something in your toolchain is trying to create resource forks inside a zip file incorrectly. Are you building some of this on a non-Mac platform? I made a point to double-click your zip file to unzip using the expected procedure. I think you can use "ditto" on the command line to achieve the same result, but not "unzip". When using Finder, I shouldn't ever get those kind of dot files. (And for the record, they aren't even correctly structured dot files.) I understand a lot of internet folks don't like Xcode. I've got a long list of Xcode complaints myself. But I still use it because, even at its worst, it's better than anything else. I have a very complex project under development that was designed to use some of the most gnarly Linux/open-source build platforms ever known. It's bit the bullet and took the time to port it all to Xcode. It just insane how much better Xcode is at this. Those poor Linux masochists have no idea.
Oct ’25