Actually, what I want to do is integrate Firebird database engine which requires icu library. But I had problems installing the official package.
Are there any successful stories that I can follow?
Post
Replies
Boosts
Views
Activity
Sorry for not stating my question clear enough. What I want is NSPopoverDelegate so that I know when the popover is closed so that I can perform some work accordingly.
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.
I have a test project. The main.storyboard has several VC scenes. One scene has 3 NSTableViews in a row and auto layout works perfectly when I run the app.
The weird thing is that each time I open the project, the top spacing constraint grows a little (56). I do not modify anything. After several times of re-opening, the value reverts to the standard value.
Soon after I posted this question, I found out why. The window property is not set yet when view is loaded.
Now comes a new question - what is the correct time/place to add the addObserver method?
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)
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?
I now answer my own question. I installed macOS 10.10 (Yosemite) and can confirm that my app does not crash.
BTW, here is the page to download older versions.
I believe this is a bug. IB is looking at the wrong place. It is looking at MYAPP/Contents/MacOS/Frameworks instead of configured MYAPP/Contents/MacOS/../Frameworks.
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...
I found out an interesting fact. When Quick Help stops working at all, If I open another project then it immediately comes back. It seems some background work has a bug.
Are there any Apple genius devs watching these forums? Hello, can you hear me?
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?!
The error is:
2023-04-28 17:53:20.523568+0800 WKWebViewTest[21469:545345] :0: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
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.
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.