I know I'm late to this IOKit party, but the following Swift code (I'm new to Swift, so point out any better practises if you see I'm doing something horrendously wrong) works for me to retrieve the IODialinDevice...
var dict : Unmanaged<CFMutableDictionary>? if (IORegistryEntryCreateCFProperties(usbDevice, &dict, kCFAllocatorDefault, 0) == KERN_SUCCESS) { let hardDict = (dict?.takeRetainedValue()) as! NSMutableDictionary DispatchQueue.main.async { self.deviceLabel.stringValue = self.deviceLabel.stringValue + (hardDict["IODialinDevice"] as! String) + "\n" } }
For my test purposes I had the deviceLabel (an NSTextField) updating just to make sure I was receiving Add and Remove Messages.
Hope this helps others as the Apple docs on IOKit are really abysmal in helping people with this low level stuff.
Post
Replies
Boosts
Views
Activity
I hope I’m understanding this correctly…. It would appear that BNDLs are actually just a folder structure with an executable/binary (and other things perhaps), similar to APPLs. BUT, what has me a bit baffled right now is the difference between a BNDL and an APPL is that an APPL has a main function to kick things off, but a BNDL does not (or I can’t see one in a BNDL's xcode project)? So other than mentioning the NSPrincipalClass in the info.plist, when during the BNDL’s lifecycle does that specified PrincipalClass get instantiated?
Hi Jana, If I'm not mistaken that code is about updating the DockTile Menu, while the application is running. While what I'm looking for is updating the DockTile menu while the application is NOT running. Which requires a NSDockTilePlugin implementation. You can see this by making sure System Preferences is not running, then Control->Click the dock tile, it still displays a comprehensive menu, even though System Preference is not running. This then allows you to Jump to specific area within Preferences and only at that point does it then launch System Preferences itself and short-cut you to the right place. That is the behavior I'm looking for 🙂
I've posted a link to a gihub code sample that works, but has been in moderation over night. What is the rough time frame for moderators to approve posts?
After further Googling I found a github repo that contained a DockTilePlugin Sample that was 7 years old. I have updated the sample so that it builds and runs with XCode 11 and enhanced it slightly to suit my needs, as I wanted to be able to dynamically update the App's DockTile menu when the app isn't running.I hope others find this update sample useful.The updated project, with the original author's ReadMe.rtf can be found on GitHub here -https://github.com/CartBlanche/MacDockTileSampleIf someone with more Objective C experience can look over the code and tell me if there are better ways of doing things, I'll update the code, or send me a PR.
After a bit more Googling I found a DockTile plugin example that is 7 years old and looking through the code it seems to have the actual DockTilePlugin project set up as a BNDL. Hence the question. The BNDL looks to be a Target, within the APPL and saves itself inside the APPL's Contents/Plugins folder.I'm in the process of updating that sample so that it builds and runs with the current Xcode, so will update my other question, once I have it working.
Thanks for all your help!As soon as I find a solution, I'll post back to this thread, as the info is as rare as hen's teeth.
Yes I found that SO and the link. I've added a comment to the SO, to ask the OP to upload the working version of the sample to a repo somewhere. We'll see if he's still around and still uses SO.I'm unfamiliar with how to use either developer contact or how to burn a DTS ticke. Do you have links on how to do both?
Setting the Focus in viewDidLayout, seems a much nicer solution. Thanks!
Hi Claude, thanks for taking the time to reply.The dynamic solution works at runtime and I used that example to get it working for mine. But if you have a look at Xcode when it is totally shut-down, it still shows a list of most recently opened projects. Some people call them Jump Lists. My limited understanding is that this uses NSDockTilePlugins and other than the documentation here - https://developer.apple.com/documentation/appkit/nsdocktileplugin?language=objc - there really is no step by step guide showing how they can be implemented. The docs say that from 10.6, this is the "preferred" method.
Looks like my image was stripped from the post. Here is a link to the behaviour in question - https://drive.google.com/open?id=1ef-Rj2NVqyrYxWoaR3YE3IoVmi_ir59Y