Can you spare a note on HOW you found the solution? I have the same exact error, but in totally different scenario - anonymous XPC service listener I create programmatically, suddenly goes astray with this error --- and I can't figure why. Now I got the idea that some remote call had wrong parameter values, or was null where null is forbidden, or something of that sort - and I'll review - but maybe you got more information to help you solve the issue?
Post
Replies
Boosts
Views
Activity
Hi, I experience a similar problem. I received a logo as .SVG image file from our graphic designer. The logo is actually text (black on clear). Now I want to display it in my Window (MacOS Cocoa) but I want it to adjust to dark-theme/light-theme automatically. I
opened it in Safari and exported as .pdf (to preserve vector graphics and quality)
renamed the PDF to "company-logo Template.pdf) as explained in Quincy's answer,
added the image file to my target and resources, and made sure it's in the built bundle, and available by name from the main bundle.
placed it in an NSImageView by name.
and now it appears as gray square in Interface-Builder, and in runtime - as nothing-at-all. It is embedded in a vertical NSStackView, and the logo item is rendered at zero size.
If I remove the word "Template" from the name - the logo looks OK on light-theme, but becomes black-on-dark-gray - almost invisible - in dark theme.
Could you please explain a bit more about how to add the "Opacity" thing, and why do I need it? What's the meaning of "Opacity" with vercor graphics, and can a vector PDF have an "Alpha channel" ??? what would it contain? vector graphics too?
However, by "avoid breaking wrongly coded software" they break our properly-coded software (some security tool with agent) that reports MacOS version to server - now we get both 10.16 and 11.0 in our servers, and there's not a single coherent API that will tell you even the "marketing" version of MacOS. we're actually bound to hard-wire translation table (10.16 -> 11.0 10.17? -> 11.1 etc.) Into our code for that. It's quite amazing, if you ask me, that MavOS 11.5.2 (some 5 major updates after 11.0) still reports that stupid 10.x on older SDK.
Any chance for an ObjC variant? I believe the underlying getifaddrs freeifaddrs getnameinfo APIs should be the same, but some of the swift trickery here worries me... if I back-translated this to C or Obj-C I might introduce issues...
I would believe Mr. Eskimo (whose OpenTransport lines of code I still keep somewhere...) had this code running long before swift existed :) So... it would be much appreciated if you pasted something here.
Thanks. Should have suspected this...
Living too many decades in the realm of C (errr and older...) I no longer see unsafeness there. Only freedom, responsibility and performance...
But I fail to see how this is less safe Than the swift code - after all you kept all the conditionals in place. The only missing? point is freeing the addrList if exception occurs somewhere? but where should such exception come from? and if it comes, would freeing that memory save you from the situation?
just wondering.
In my case, a shell script is unavoidable (post-install script in an Mac Installer .pkg).
However, copying the .app bundle completely (using cp -R) seems to work fine --- only if USER then double-clicks the app to open it.
If however, another app will use NSWorkspace API to try and launch it, I get an error dialog saying the app is corrupt - and the NSError says it couldn't find a binary to run!!!
` NSWorkspace *ws = [NSWorkspace sharedWorkspace];
NSWorkspaceOpenConfiguration *conf = [NSWorkspaceOpenConfiguration configuration];
conf.addsToRecentItems = NO;
conf.activates = NO;
conf.hides = NO;
conf.appleEvent = appleEvent;
NSURL *appURL = [ws URLForApplicationWithBundleIdentifier:appBundleID];
[ws openApplicationAtURL:appURL configuration:conf completionHandler:^(NSRunningApplication * _Nullable app, NSError * _Nullable error) {
if (error!= nil)
NSLog(@"Failed to launch app UI %@, error:%@", appBundleID, error);
else
NSLog(@"Launched app %@ in the background.", appBundleID);
}];
`
Maybe an AppleScript will "install" it better? the app isn't installed in /Applications, but rather in a private place, and is a menu-bar "status item" app
Sir, what does Hack.hackPath(dofFile.path) mean or do? can't see any such class/object/function definition. Is it at all necessary?
And why would you need that long dance of building a file url in the user's Documents' folder, when you could (in theory) just supply a simple absolute path as string? (pun unintended)
Did you finally find a decent way to draw a line over your CGImage (in your scenario and context) ? I'd LOVE to see how. I have similar task, but I'm on the Mac, and my "line"(s) aren't coming from user touches, but rather from some image analysis that finds shapes in the image, and I don't need to ever draw the thing onscreen - just process the image and produce another image. Still - I'd like to be efficient and not copy the whole (huge! in my case) image every time I need to draw a line!!!.
Have you found the optimized way to work with this? BTW -- I think if you have a CALayer with a CGImage, you should be able to continuously draw over the layer itself, and the final "merging" of the layer with its image will only be done when you "draw" (or otherwise "output") an image from that. I don't know how to do any of this (or I wouldn't be writing this) but I think that might work?
In anyway, be kind to add your own answer hopefully with little helpful code sample. Thanks
Hi Ken, is it also possible to use a CALayer instead of a bitmap context to repeatedly draw over that same original CGImage? will it be faster? how does one that?
Who said that MacOS development should be generally case-insensitive?
Explanation. Our current product structure is similar to many "linux style" deployments - a bunch of binaries sprawled all over the place - /etc /tmp and the like, with cumbersome shell scripts for installers and lots of "config" files everywhere... not even a bundle that can be code-signed as a whole. All TCC handling is clunky because I don't even have a "bundle ID" for components to rely on - just paths. What I'd like to do (and did in the past for other employer) is to restructure all components into a single bundle (back then, I made it a "Preferences Panel" with minimal UI), with all the deploymeny (dynamic libraries, private frameworks, daemons, agents, resources and so on) within the bundle. Then - code-signing, installation and removal are a breeze, tempering with the product is harder, and most important - integration with the "Mac" world of APIs (generally Cocoa but other things too) is far more effective (I just HATE config files. UserDefaults are KVO compliant, and maintain much better, and...) well. In that respect, I'd like to have this Java-written "service" be an XPC-Service available to other components WITHIN its bundle. Is this possible?
As always, you ARE a life saver. Thank you very much. Will hold this doc close to my heart for years to come.
In my case, there's a "product requirement" to be able to work and fail "silently" when we don't have full-disk-access (depending on some remote customer configuration). So we NEED to know in advance, whether reading some files is going to fail. In the "silent" mode, we do NOT want MacOS to pop up any alerts to the user and distract them. We'd rather do it sometime else, later, e.g. on next launch or so. I'm not the OP and my needs are different, plus my product isn't "App" (rather a global Agent) which makes this requirement reasonable. User doesn't expect IT security background agents to pop requirements for disk access... We do have UI, but we present it in very small set of situations, controlled precisely by customer configuration.
So the question remains: How do I know whether or not my process has "Full Disk Access" ? Other TCC entities (like Accessibility for instance) provide such APIs to query TCC for permissions.
And another issue with that approach is, sometimes good user interface dictates SILENT failure attempting to open a file, and SPECIFIC timing for asking the user for permissions. For this - knowing in advance whether or not app/process has "full disk access" granted - is needed (I think - required).
Or, for a small effort, build your own command-line binary (say using swift or Objective-C) to call just that...