Post

Replies

Boosts

Views

Activity

SwiftUI DocumentGroup how to auto-open converted document after export?
Most users of my app should be creating new documents in my app by importing existing files from an open-source file format through a conversion process into my proprietary format. While they could create files new from scratch in my app, that will cost $4M, and my customers are funded by donations. My app can read the open-source file format, but not write to it because it can't represent some of the information my customers need. I can also open read / write my own proprietary format. With my UIDocumentBrowserViewController-based MacCatalyst app it was possible to do an "import" from the open-source format, I would auto-run the conversion process, and the user could then immediately "save" the newly created file. Unfortunately, UIDocumentBrowserViewController has never worked correctly in MacCatalyst, and the Apple engineers know it and won't fix it. (I've demoed the problem to DTS 2 years ago, they had a bug fix in beta versions of macOS 12 which I'd been waiting for for 2 years, and I spent a month nights and weekends building my app to get it ready for release, but Apple removed the bug fix shortly before final release.) Users just think my app is broken. SwiftUI DocumentGroups with MacCatalyst don't seem to have the ui document browser bugs, so I'd like to re-write the top-level of the app with SwiftUI document groups. But how do I get the doc opened in the new format after export? I can't replace or delete the original open-source files, they have to remain unaltered in place. Help?! Also, one more thing. Because the open-source file format doesn't actually contain all the information my app needs (which is why I need the proprietary format in the first place), for 2/3 of the files files I'll need to get a second file in yet a second open-source file format and combine the data with the first open-source file in my initial conversion process to write out my proprietary file. This turns the $4M content-conversion problem into a $4k problem. This second file is optional for the user to pick, so I'll want to be able to proceed if they skip it. It took months to figure out how to get one .fileImporter to get used twice with different allowed file formats. (because you can't have 2 fileImporters......????.....) and now also I don't know how I'd capture that cancellation on the second import and proceed any way with the export. since the cancellation seems to just go into the ether. Workarounds I don't want you to offer me: Re-write everything in AppKit I don't want to write an AppKit version of my app, because of how text fields and scroll views work inside collection cells with drag & drop. UIKit makes it "just work". AppKit makes the UX a finicky nightmare people can take months to figure out how to use, and then feel frustrated with how hard it is once they do figure it out. And the issue goes all the way down into how events are assigned to views by the os. Be iPad-only Yes, my uidocumentbrowserviewcontroller code works perfectly well on iPads, and always has. I don't want to be iPad-only. Yes, I see iPads as better experiences for editing and content creation than a Mac, especially with an Apple Pencil with my painstakingly-crafted UIKit WYSWIG GUI editor. But for now, most of my customers have these files on Macs not iPads and they're probably not tech savvy enough to figure out how to move a complex file / folder structure of categorized files over from one to the other, so we work with what we got. Create a new document before beginning the import process What if users "open with..." one of the open-source files and pick my app? What if the file they pick to open in the doc browser is in the other format? I can't display the contents of the open-source file without first converting it into my format.
0
0
446
Oct ’22
How does a user fix an errant kMDItemContentType?
My app imports files from a particular open standard that has a published Uniform Type Identifier (UTI). Recently, another mac app store app added some erroneous UTI declarations for files with the standard file extension for that file type. Using yet another app (non-app-store) to save data off in this common open file format, the system picked one of the erroneous UTI's from the app store app, and now my app and another (major gold-standard) app cannot open the file. Running mdls on the file reveals the kMDItemContentType is a wrong value, and of the 6 apps on my machine that can open and save that format, only the app from the store app is declaring the erroneous UTI value the system picked. Changing the file extension to something else and back to the right thing doesn't work. Changing the default app to open the file didn't work. How do I change the system's incorrect inference of the kMDItemContentType? How can my users do so? My app can't open the file (it's grayed-out in the file browser), but it can open other apps with the same file extension (which perhaps had their content-types set before the app store app with the erroneous definitions was updated to include erroneous definitions). Would merely deleting the offending app fix, or are these files permanently unopenable?
1
0
867
Oct ’21
Does UIPointerInteraction work on MacCatalyst?
I thought it would be an easy way to add a custom mouse icon. I didn't see anything that said it wouldn't work. I followed the instructions to create a UIPointerInteraction for a custom view and set the delegate, add it to the view (which has other working interactions, including a hover gesture recognizer), return a region from the delegate method, and return a UIPointerStyle with a UIPointerShape with the +beamWithPreferredLength, but I saw nothing. My delegate methods weren't called. I tried disabling the hover recognizer, still nothing. The view's other interactions include drag, drop, and context menus. Xcode 12.5.1, mac os 11.6
2
0
907
Oct ’21
Can promo codes be scanned in the mac app store like gift cards?
I'm hosting a booth at a few conferences this summer with demos of my mac app. I'd like to offer a small number of promo codes to people who visit the booth, fill out an application and meet some requirements that I think make them shoe-ins for being influencers, maybe 3 per conference. I'd announce it kind of like a contest, but the idea is they are people who are very interested and would promote the use of my app. I'd like to offer them something substantial to take with them that has the promo code on it, kind of like a gift card, so they don't forget "this is valuable". My first thought was actually give them a gift card, but that's silly because the whole point is no real money needs to get involved, and a real gift card could be used for things other them the in-app purchases in my app. Getting custom-printed plastic cards is the easy part. The hard part is what I put on it. Is there a way to display promo codes so that the gift card code scanner in the mac app store can read the promo code? Is all I have to do position the human-readable code in a mono spaced font in a box along the top edge like a gift card and it'll be recognized? Do we know what font the gift cards use? / Does it matter?
0
0
581
Apr ’21
Is there a sample app for UIDocument using UIScene for MacCatalyst?
I've spent the last 1.5 years of my life trying to figure out how to make a uidocument-based app work with UIScene for MacCatalyst. Has anyone succeeded? Are there examples anywhere? Any guides or tutorials? Apple doesn't even have a template in Xcode! Apple's documentation is either fractured, missing or inaccurate. I always get crazy errors. The #1 problem I have is auto-re-opening a doc after the app quits. I get blank windows where the doc used to be, but on top of that I get an open-dialog box. Debugging says the os sees my sessions, but then throws them away and doesn't tell me why... When I quit the app, saving fails in sceneWillResignActive (with no explanation I can find), closing the document fails in sceneDidDisconnect(...) (with no explanation I can find), after the app quits the debugger stays running while profiler says my app is in the background, and then the watch dog timer expires and kills my app. I'm not doing any background work... I don't have any crazy long-running processes. At first I thought "oh, let's not write new features in AppKit, UIKit is soooo much easier, I'll just re-write the whole darn thing in MacCatalyst and then I can write new features for both Mac & iPad", but noooo. It's the fundamentals I can't get to work in MacCatalyst. The drag & dropping? works perfectly. But docs don't save - sometimes, and they don't reopen, but it all works perfectly on an iPad. :Picard facepalm:. I'm about to just give up trying to make apps entirely - and I've been doing it for 14 years!
9
0
2.3k
Mar ’21
Can NLTokenizer handle .sentence s?
My app would significantly benefit from being able to identify sentences in text. So I'm trying NLTokenizer, since the api makes it looks like it could do that. I'm not able to obtain sentences as tokens. However, if I change the unit to words or paragraphs, I do get words and paragraphs respectively. Am I missing something or is this a bug? Here's some small example code: let source = "It was many and many a year ago, in a kingdom by the sea. \"Quiet\", said the raven." let tokenizer = NLTokenizer(unit: .sentence) tokenizer.string = source tokenizer.setLanguage(.english) print("begin") let tokens = tokenizer.tokens(for: source.startIndex..<source.endIndex).map({ range in return source[range] }) print(tokens) print("end") I expected to get: begin  ["It was many and many a year ago, in a kingdom by the sea.", "\"Quiet\", said the raven."] end But what I actually get is: begin [] end I found a blog where someone had claimed they had iterated the sentences using NLTokenizer, but when I examined his output, he had actually enumerated the words. macOS 10.15.6 beta 1
1
0
1.1k
Jun ’20
UIDocumentPickerViewController for outside-the-sandboxed directories ?
In my app, users will usually want automatic syncing of a set of many hundreds of files with several members of a team, so mere personal iCloud just won't cut it. In my soon-to-be-released Mac app, that was easy. I just let the user pick a directory and use bookmarked security scoped urls, and if they pick a dropbox or google drive -synch'ed folder, fine; it just works. It even detects changes and animates my summary details of the set of files in my UI live.However, on iOS, I'm not sure whether UIDocumentPickerViewController can do what I want. When I initialize it like so:UIDocumentPickerViewController(documentTypes: [kUTTypeFolder as String, kUTTypeDirectory as String], in:.open)and run it, but when I delect a directory, the button isn't enabled to proceed.Can someone tell me IF UIDocumentPickerViewController is suppossed to be able to handle getting a book-markable url to a directory outside my sandbox?
4
0
4.3k
Jun ’19
nil Progress.estimatedTimeRemaining ?
There is no documentation for Progress.estimatedTimeRemaining. I want to get an estimated time to completion from my Progress object, but in my experiments on macOS, it's always nil. What do I need to do to get a non-nil result?In my case, my progress var is periodically (once per second) updated from the var progress:Float field of a AVAssetExportSession.Here's what I've got now that's not working: (the progressIndicator is correctly updating) @IBOutlet weak var timeRemainingLabel:NSTextField? lazy var nsProgress:Progress = { ()-&gt;Progress in let prog = Progress(totalUnitCount: 100) return prog }() var progress:Float = 0.0 { didSet { progressIndicator?.doubleValue = Double(progress) nsProgress.completedUnitCount = Int64((progress*100.0).rounded()) if let time = nsProgress.estimatedTimeRemaining { timeRemainingLabel?.stringValue = timeFormatter.string(from: time) ?? "" } } } lazy var timeFormatter:DateComponentsFormatter = SongTitledFormSectionsTableCell.newDurationFormatter() static func newDurationFormatter()-&gt;DateComponentsFormatter { let formatter = DateComponentsFormatter() formatter.allowedUnits = [.second, .minute] return formatter }
1
0
1.1k
Feb ’19