I believe starting from version 15, Developer Documentation is broken in several ways (at least for me).
Quick Help pane shows meaningless header information about many classes:
Reveal in Navigator does not work in most cases:
For example stringWithFormat:
Post
Replies
Boosts
Views
Activity
I have a weird problem with Xcode v15.4.
For some unknown reasons, it sometimes becomes a zombie process - I cannot even quit it using CMD+Q, nor can I close open projects. I have to forcibly kill the process using Activity Monitor.
The problem will mostly strike after a long time of idle time (hours or even days).
Does anyone else have this same problem? Is there known workaround?
BTW, when it becomes a zombie process, another related com.apple.dt.SKAgent process will begin consuming much CPU time forever.
I want to implement a stack that works quite like a circular buffer.
void** pp = malloc(sizeof(id) * 100);
pp[index] = someObject;
// later on somewhere:
MyObject* myObj = (MyObject*)pp[index];
Is this correct? Does this approach work with ARC?
I used to run VirtualBox on macOS to run Windows guests for some reasons.
Recently I bought a new Mac mini M1, now I have a problem - VB does not have a stable release for arm (yet).
What other options do I have?
BTW, I came across this doc article (https://developer.apple.com/documentation/virtualization/running_macos_in_a_virtual_machine_on_apple_silicon). I read thru it, but could not conclude if it offers the same functionalities as a full-blown VM suite; and more specifically I want to run Windows guests.
I came across a useful repo on GitHub:
https://github.com/GianniCarlo/DirectoryWatcher/blob/master/Sources/DirectoryWatcher/DirectoryWatcher.swift
self.queue = DispatchQueue.global()
self.source = DispatchSource.makeFileSystemObjectSource(fileDescriptor: descriptor, eventMask: .write, queue: self.queue)
self.source?.setEventHandler {
[weak self] in
self?.directoryDidChange()
}
self.source?.setCancelHandler() {
close(descriptor)
}
self.source?.resume()
How do I translate this to OC version? I have an app that was written in OC and I plan to incorporate this directory watcher into the project.
It's quite annoying (maybe it's only my personal interests). Some apps or the macOS system always create ~/Applications/asr directory and create some txt files in it.
asr20240708_1638030_0.txt
{"type":"asr","wp_version":"","easr_version":"e792c1d2b4b5055e56fb902dfefdb483802041cc_Thu_Dec_30_17:18:43_2021_+0800","spil_version":"","wpe_version":"","vad_version":"9db42b766a4bc4e853bfa3fd2f846bf931d6c05f_Wed_Mar_24_15:56:16_2021_+0800","header_type":0}
It there any way to disable this 'useful' feature?
I can't believe this. I am not able to remove the following garbage items:
Right clicking does not provide any menu items to remove the garbage items.
It seems I can declare variables like below in a source file:
private let var1 = 1234
fileprivate let var2 = "abcd"
class MyClass {
// ...
}
So what's the difference between the 2 vars here?
I don't know when/why my assistant editor opened on bottom. I don't have any idea how to get it back to its original position (on right side). It's annoying.
In other IDEs on many popular platforms, developers have the ability to analyze unreferenced header files in source code (either visually or thru warnings), like below:
// sourcefile.c
#include <file1.h>
// file2.h is not referenced in this source code file, so the following line would be grayed out in a well known iDE
#include <file2.h>
Is this possible in Xcode?
NSDate* now = [NSDate date];
// How get midnight time of now?
When Xcode IDE inserts IBOutlet or autocompletes method signatures, it places the * char next to the var name:
@property (weak) IBOutlet NSButton *aButton;
- (NSString *)someMethod:(NSString *)param1 {
}
But my convention is put the * char right after the type name:
@property (weak) IBOutlet NSButton* aButton;
- (NSString*)someMethod:(NSString*)param1 {
}
Is there anyway to tell Xcode to follow my convention?
In XCTestCase, I write data to a file "/tmp/somefile", but the file does not exist in /tmp when I do ls in Terminal.
Where is the file actually created?
Is there any way to tell if the user clicked X button in windowWillClose delegate method?
- (void)windowWillClose:(NSNotification *)notification
I have the following code:
+ (BOOL)activateWindow:(NSWindow*)window
{
if (NSApp.activationPolicy != NSApplicationActivationPolicyRegular)
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
if (window)
{
[NSApp activate];
//if (window.isMiniaturized) [window deminiaturize:nil];
[window makeKeyAndOrderFront:nil];
}
return YES;
}
+ (BOOL)hideWindowFromDock:(NSWindow*)window
{
if (NSApp.activationPolicy != NSApplicationActivationPolicyProhibited)
[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
window.isVisible = NO;
return YES;
}
I hide app main window by setting NSApplicationActivationPolicyProhibited if it is minimized or being closed.
The code worked most of the time. But since upgrading to Sonoma, sometimes it won't correctly activate main window. The window icon reappears in the dock, but the window won't show up. I have to click on the window icon again to let it 'order front'.
Sometimes, I observe a very weird behavior of the window being activated. It 'order front' and then disappears and re-appears.