Post

Replies

Boosts

Views

Activity

Reply to Which version of Xcode works best with macOS 12 (Monterey)?
I am not sure if the problems are only specific to me, but I did not experience similar ones for the past many years. The Quick Help pane always stops displaying help after some time of use (for example, after debugging). I get weird auto layout design time issues in IB (I am sure my constraints are correct). Today I got a weird error when I build one of my test project (something about Array Controller but not in my code). When I close and re-open and build, the problem is gone.
Mar ’23
Reply to How can I know when an NSTextField gets input focus (first responder)?
I found out why myself. I create a custom NSWindowController: @implementation MainWC - (void)windowDidLoad { [super windowDidLoad]; MainVC* vc = (MainVC*)self.contentViewController; [vc windowLoaded]; } @end And in MainVC: - (void)windowLoaded { [self.view.window addObserver:self forKeyPath:@"firstResponder" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil]; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context { NSView* oldView = change[NSKeyValueChangeOldKey]; NSView* newView = change[NSKeyValueChangeNewKey]; NSLog(@"%@ (%@) ====> %@ (%@)", oldView.identifier, oldView.class, newView.identifier, newView.class); } It seems when a textfield is focused, it immediately resigns and gives focus to its inner textview: 2023-03-24 18:02:54.841247+0800 ObjcTest[25855:1521206] _NS:10 (NSWindow) ====> normal (NSTextField) 2023-03-24 18:02:54.846902+0800 ObjcTest[25855:1521206] normal (NSTextField) ====> (null) (NSTextView) 2023-03-24 18:02:56.032290+0800 ObjcTest[25855:1521662] Sleep done in q 2023-03-24 18:03:09.653850+0800 ObjcTest[25855:1521206] (null) (NSTextView) ====> _NS:10 (NSWindow) 2023-03-24 18:03:09.657517+0800 ObjcTest[25855:1521206] _NS:10 (NSWindow) ====> mytextfield (MyTextField) 2023-03-24 18:03:09.657677+0800 ObjcTest[25855:1521206] -[MyTextField becomeFirstResponder]: <MyTextField: 0x7f8dfa123eb0> 2023-03-24 18:03:09.659349+0800 ObjcTest[25855:1521206] -[MyTextField resignFirstResponder]: <MyTextField: 0x7f8dfa123eb0> 2023-03-24 18:03:09.659522+0800 ObjcTest[25855:1521206] mytextfield (MyTextField) ====> (null) (NSTextView)
Mar ’23
Reply to chevron.down.square.fill image name
Thanks for your replies. Okay, I found it here https://developer.apple.com/sf-symbols/ I have a new question. My app min target OS is macOS 10.10. Can I use [NSImage imageNamed:@"chevron.down.square.fill"] in code so that it still works on macOS 10.10? Or should I just use the official app and export the symbols as pictures?
Mar ’23
Reply to CFBundleIdentifier not match?
I tried to upload one of my App Store apps, got a new error (upload failed): Metadata/Info.plist Mismatch. The value for bundle_version in the metadata.xml file does not match the value for CFBundleVersion in MYAPP [net.neolib.MYAPP.pkg/Payload/MYAPP.app]. (ID: 9675c1c2-4332-43d8-87d9-4e7f51c83f1b) I feel I am being tortured and helpless...
Apr ’23
Reply to IB_DESIGNABLE and dylib problem
Ah, it's agony! I struggled with this for many hours and finally get it to work, in a mysterious way. At first, setting @rpath to "@loader_path/../Frameworks" or "@executable_path/../Frameworks" did not work. After many tries, I set it to both of the 2 paths and IB_DESIGNABLE started working. But I may be wrong because I tried many many times and ways. It might be that I once set a hardcoded path to the directory where libCocoaSQLite.dylib resides in ("/Users/USERNAME/some/long/path/to/the/dylib"). Then maybe Xcode caches the location somewhere and voila it works! Now the weird thing is that even now I set @rpath to "@loader_path/../Frameworks" alone, IB_DESIGNABLE still works. I cleaned build folder and even rebooted macOS. Is it mysterious?!
Apr ’23
Reply to Weird: let statement leads to nil
It seems self.webView.evaluateJavaScript cannot be called within async context: //Task.init { //await self.test1() //try? await self.webView.evaluateJavaScript("alert('test')") } The above simple code runs without any problem in synchronous mode, but will cause a runtime exception if is called in Task.init block. Is this by design? But I don't believe it.
Apr ’23
Reply to Generated xcarchive has no built dylib
I submitted a tick in Apple's feedback center here and got a reply form Apple genius: Change SKIP_INSTALL to NO. If it’s set to yes, then your library product isn’t copied into its install location, and thus doesn’t appear in the archive. Xcode 7.2.1 is a pretty old compare, it probably had bugs in the opposite direction. I really don't understand this default setting. I want a dylib when I create a release archive, but with this default setting on, I don't get one. What's the point? Actually I know the reason behind - Apples is forcing developers to upgrade to latest version. This is just one of many nag bugs deliberately planted into older version of Xcode.
May ’23