Let's say the type of project doesn't work well by using the LSApplicationCategoryType property in Info.plist.
How can I trigger it via code in MacOS?
Posts under macOS tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I rewrite an old project since OpenGL is deprecated and the downgrade to
High Sierra goes with the lost of the old project.
Here is the drawRect:
- (void)drawRect:(NSRect)dirtyRect
{
[super drawRect:dirtyRect];
if(backgroundColor == 1) glClearColor(0.95f, 1.0, 1.0f, 1.0);
else glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0 ,0.0, -10.0);
// After mistake
I wrote PushMatrix()
glTranslatef(-0.01 ,-0.01, -10.0); // Screen Shot 0
// glTranslatef(-0.25 ,-0.25, -10.0); Screen Shot 1
glLineWidth(1.0);
glRotated(rotationX, 1, 0, 0);
glRotated(rotationY, 0, 1, 0);
glCallList(axes);
// After mistake
I wrote PopMatrix()
// Axes Vertices of xx,y,z are 1.0
// With vertices +/-0.99 nothing is drawn
[self glError];
[self.openGLContext flushBuffer];
}
I hope you Accept my Text and hope you can help me !
Mit freundlichen Grüßen
Uwe
Screen Shot 0
Screen Shot 1
Adding a second "DocumentGroup" to a document based SwiftUI auto converts the "New" menu item into a submenu, with one item "New Document".
I'd like to add a second item to that submenu, to create a new instance of my second doc type. Googling around finds one solution, but that doesn't work as I'd expect it to with Ventura 13.6.5 and Xcode 15.2.
The solution linked to below, adds a menuitem under the "Open Recent" menu, not in the "New" submenu.
https://github.com/Asperi-Demo/4SwiftUI/blob/master/Answers/Handle_different_document_types.md
Changing the position to "before", also doesn't add it to the menu, and if you replace ".newItem", you then have to manually handle the Open dialog and the Open Recent menu.
So what am I missing?
I have an iOS app that uses os_signpost API for instrumentation.
When I profile it from Xcode on real iOS device, it works as expected.
When I profile its macCatalyst variant (using the identical code) on the same Mac where Xcode is running, the os_signpost Instrument does not show anything, not even the Apple provided signposts that are otherwise visible on the iOS.
How do I make it work?
We have QuickLook thumbnailing framework which is used to provide thumbnails for custom file types. However, how can we provide thumbnails for system defined file types for eg. image file types?
Is there any way to achieve this?
I want to traverse my local Google Drive folder to calculate the size of all the files on my drive.
I'm not interested in files or directories that are not present locally.
I use getattrlistbulk for traversing and it takes way too much time. I think it is because FileProvider tries to download metadata for the directories that are not yet materialised.
Is there a way to skip non-materialised directories?
Hi,
I'm having an issue with an app written in Swift on Xcode. This app implements an AVKit player for playing HLS audio/video streams, and the player opens as soon as I click the button for the TV channel I want to watch. When I debug the app from Xcode, everything works perfectly and the player opens without any issues. However, when I distribute the app via “Archive,” the initial interface with the buttons is displayed correctly, and the audio-only streams are played (with a reduced player). But as soon as I click on an HLS audio/video stream, the app crashes.
Here is the crash log:
Crashed Thread: 1 Dispatch queue: com.apple.root.utility-qos
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process: TVStreamsApp [42052]
[...]
Thread 1 Crashed:: Dispatch queue: com.apple.root.utility-qos
0 libsystem_kernel.dylib 0x19f62ea60 __pthread_kill + 8
1 libsystem_pthread.dylib 0x19f666c20 pthread_kill + 288
2 libsystem_c.dylib 0x19f573a30 abort + 180
3 libswiftCore.dylib 0x1af6d99f4 swift::fatalErrorv(unsigned int, char const*, char*) + 128
4 libswiftCore.dylib 0x1af6d9a14 swift::fatalError(unsigned int, char const*, ...) + 32
5 libswiftCore.dylib 0x1af6ed22c getSuperclassMetadata + 816
6 libswiftCore.dylib 0x1af6ed4c4 _swift_initClassMetadataImpl(swift::TargetClassMetadata<swift::InProcess, swift::TargetAnyClassMetadataObjCInterop<swift::InProcess>>*, swift::ClassLayoutFlags, unsigned long, swift::TypeLayout const* const*, unsigned long*, bool) + 84
7 _AVKit_SwiftUI 0x235cabea0 0x235ca7000 + 20128
8 libswiftCore.dylib 0x1af6f9cac swift::MetadataCacheEntryBase<(anonymous namespace)::GenericCacheEntry, void const*>::doInitialization(swift::MetadataWaitQueue::Worker&, swift::MetadataRequest) + 772
9 libswiftCore.dylib 0x1af6e8dc4 _swift_getGenericMetadata(swift::MetadataRequest, void const* const*, swift::TargetTypeContextDescriptor<swift::InProcess> const*) + 2744
10 _AVKit_SwiftUI 0x235cabe14 __swift_instantiateGenericMetadata + 36
Thanks in advance for your help!
It looks like macOS Sonoma doesn't delete /tmp files in containers periodically or on reboot, like it does for system /tmp or $TMPDIR.
Is it a bug or is it in on purpose?
Our app didn't delete its temp files and some users have quite a few of them.
We will make the fix so that we clear after ourselves in the future but should we delete temp files manually on start for existing users?
Is there some notification that apple provides that I can register to, and get notified whenever there is a 'battery low' state?
I want to perform certain task in my application for low battery.
Is there some way to identify this?
I have a bundled application(.app file) in macOS which is a non-interactive application. This app does not link to any GUI frameworks and I am able to launch it using the 'open' command in a normal GUI login session.
However, when I perform ssh login to that user and then If I try to launch the application, it fails to launch.
I assume that this is happening because my ssh session is a non-GUI session, and 'open' command is due to some reason failing to run in a non-GUI environment, but I m not sure.
Can someone help me understand why is this happening?
When our NETransparentProxyProvider system extension is installed on the system it seems that external images from emails do not load on the Mail application. The extension does not have to be running to experience this issue.
When we uninstall the extension, these same images load on the Mail application. Another way to get the images to load seems to be to disable "Hide IP address" under Settings > Privacy.
We can see this issue present on the latest macOS 14.5. I have filed FB13805670 for this issue.
Please advise if this is a known issue or if there is a solution.
Has anyone else seen this happen with their macOS apps in TestFlight?
The situation:
When I launch my app that's been downloading via TestFlight.app, it often comes up with its main window deactivated.
Also, when I have open more than one window and close one, the other window doesn't come to front either.
In either case, activating the app or clicking into a window will activate it properly.
It feels as if there's another window that's not visible but somehow keeps getting activated.
I have this happen on two Macs running both Sonoma and Monterey.
Also, if I take the very same build that I had uploaded to TestFlight and run it directly, it works correctly. So I suspect that TestFlight somehow messes with my app's windows.
If you want to test this yourself: Get the app thru this link: https://findanyfile.app/TestFlight/
Then launch it. Often, the Find window will already come up without being active. Activate it, then open the Preferences window by typing cmd-comma. Then close the Prefs window with cmd-W. This should re-activate the Find window but will instead leave it deactivated, and none of the menu shortcuts (such as cmd-comma, cmd-N or cmd-Q) work. That's the bug.
I wonder how I can debug this to find a work-around for this odd behavior.
E.g, I'd like to see if there is indeed a semi-hidden window causing this. How would I do this? I could probably make a new TestFlight build that queries the app's windows array and logs it. But are there other ways to query an app's windows? I tried AppleScript, but since my app isn't scriptable, I only get an error -1728 for tell app "Find Any File" to get windows.
For scheduling purpose our Mac application using crontab terminal commands, which are working fine when sandbox is not enabled.
For submitting the application to Appstore, we enabled the sandbox option and after that Crontab commands are not working. Getting the error messages as,
/bin/sh: /usr/bin/crontab: Operation not permitted.
Could you please guide us how to use the crontab commands when sandbox option enabled.
In our macOS daemon process, we are trying to validate a leaf certificate by anchoring intermediate CA cert and evaluating it using SecTrustEvaluateWithError. The leaf certificate contains couple of non-critical MS extensions (1.3.6.1.4.1.311.21.10 and 1.3.6.1.4.1.311.21.7). The macOS API fails to parse these extensions and does not evaluate the cert chain. Below is the error returned:
{
NSLocalizedDescription = "\U201abc\U201d certificate is not standards compliant";
NSUnderlyingError = "Error Domain=NSOSStatusErrorDomain Code=-67618 \"Certificate 0 \U201abc\U201d has errors: Unable to parse known extension;\" UserInfo={NSLocalizedDescription=Certificate 0 \U201abc\U201d has errors: Unable to parse known extension;}";
}
As per RFC2459, a non-critical extension can be ignored by the system:
A certificate using system MUST reject the certificate if it encounters a critical extension it does not recognize; however, a non-critical extension may be ignored if it is not recognized.
So, why does macOS not ignore these non-critical extension and returns a failure? OS version is 14.4.1.
At my current company we have an app that has a lot of third party dependencies. Recently vendors started providing code signed XCFrameworks and we would like to use the code signed frameworks without any modification in our released app (don't tamper with the signature, don't remove it, don't resign it).
We have a problem, that upon downloading the XCFrameworks from an internal artifact server or upon moving the XCFrameworks on disk during the build process, macOS starts producing temporary files, like .DS_Store, ._* files (for every file X, there is additional ._X file created). Files like this are sometimes called "turdfiles", like here.
The files are produced inside of XCFrameworks and inside of the _CodeSignature folder, making
codesign --verify --verbose=4 Example.xcframework
fail and XCode to complain and fail the build process.
I wrote a script that cleans up the _CodeSignature folder from all known turdfiles and then inspects the output of codesign to indentify all surplus files and removes them - this has to be 2 steps, because codesign goes crazy if you tamper with _CodeSignature directory.
We run the script in random places of the build system where it seemed to help.
Is there any system solution to fix this? Isn't everyone having this problem now, with the introduction of codesigned XCFrameworks? There were tens of people in the company having this issue before we hacked it together using the cleanup script.
I have used functionality of changing user's password programmatically using the OpenDirectory framework. Once the password is updated successfully, can be use this password for Login sessions and authentication wherever required. But the same password is failing authenticate with Local Authentication Framework that is with LAContext and prefers always older password. Even restarting machine won't work.
Changing current user's password using below method -
do {
let node = try ODNode(session: ODSession.default(), type: ODNodeType(kODNodeTypeLocalNodes))
let user = try node.record(withRecordType: kODRecordTypeUsers, name: NSUserName(), attributes: nil)
try user.changePassword(currentPassword, toPassword: newPassword)
print("Password changed successfully")
} catch var error {
print(error)
}
Once password is updated, then trying to authenticate password with LAContext using,
let context = LAContext()
context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: "AuthenticationMessage".localized()) { success, error in
DispatchQueue.main.async {
completion(success, error)
}
print("authentication error = (String(describing: error?.localizedDescription))")
}
It won't accept the updated password. Any idea how to solve this problem?
Hi,
For the very same plugin dlopen() sometimes fails. The library is present but sometimes it returns NULL and sometimes a valid plugin handle.
Here is the code:
char *filename;
void *plugin_so;
filename = "/Applications/com.example.MyApp/Contents/Plugins/myplugin.dylib";
plugin_so = dlopen(filename,
RTLD_NOW);
I have debugged using lldb checked filename and it is present.
The myplugin.dylib file supports 2 architectures, arm64 and x86_64.
regards, Joël
sudo ifconfig en0 ether [MAC address]
Now results in
ifconfig: ioctl (SIOCAIFADDR): Can't assign requested address
Hello.
Is there a legal way to block iOS devices from being mounted on macOS?
I noticed, that when an iOS device is connected, it pretends to be like a storage device but it is not. It not even going through diskArbitration. It seems that some fileProvider is taking place there.
I know that it is possible to do via the MDM profile:
<key>PayloadContent</key>
<dict>
<key>.GlobalPreferences</key>
<dict>
<key>Forced</key>
<array>
<dict>
<key>mcx_preference_settings</key>
<dict>
<key>ignore-devices</key> <true/>
</dict>
</dict>
</array>
</dict>
</dict>
But is there some programmatic solution?
If I use EndpointSecurity and block file operations for the usbmuxd process on /var folder, it prevents iOS devices from being mounted. But wouldn't be there any negative side effects from such a solution?
I am developing a File Provider on Mac. I am marking some items within the domain as 'shared' via the NSFileProviderItemProtocol. However, the text 'Folder shared on iCloud by me' appears in Finder when these items are marked as shared.
Is this correct? My provider has nothing to do with iCloud, which is, of course, the cloud developed by Apple. Is there a way to change this text or remove it?
I've attached an image that shows the problem.