Post

Replies

Boosts

Views

Activity

Zombie Xcode problem
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.
2
0
334
Aug ’24
Need Objective-C translation of DispatchSource.makeFileSystemObjectSource
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.
2
0
533
Jul ’24
How disable ~/Applications/asr auto creation
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?
0
0
250
Jul ’24
IDE generated *varname problem
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?
0
0
417
Jun ’24
How activate window correctly using activationPolicy
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.
1
0
593
Jun ’24
Cannot get NSTimer working in another thread
I need to create timers in another thread (not on main): @implementation AppDelegate { NSThread* _worker; } - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { _worker = [[NSThread alloc] initWithTarget:self selector:@selector(main) object:nil]; [_worker start]; } - (void)main { [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timer_tick:) userInfo:nil repeats:YES]; [NSThread sleepForTimeInterval:INFINITY]; NSLog(@"**********************"); } - (void)timer_tick:(NSTimer*)timer { NSLog(@"%@", NSThread.currentThread); } The timer never gets fired. What's wrong with my code?
2
0
561
May ’24