You should read the document of the Timer. The timer need to run in a runloop, which Window has but menu hasn't. So if you want to use a timer inside the menu, you may need to create a runloop and add the timer to it. That might work.
Post
Replies
Boosts
Views
Activity
This is not a meaningless issue. This will cause unexpected behavior like error alert doesn't show in SwiftUI. If you encounter the same like me. You can get the window and make it key and front to fix this issue.
I used https://github.com/happycodelucky/SwiftUIWindowBinder to get the NSWindow. And used below func to make it key and front.
var body: some View {
WindowBinder(window: $window) {
// content view
}
.onAppear {
makeKeyAndFront()
}
}
private func makeKeyAndFront() {
if let window {
window.makeKeyAndOrderFront(nil)
} else {
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100)) {
makeKeyAndFront()
}
}
}
I have a workaround.
Get Critical Alert Permission from User instead of Apple
https://zhaoxin.pro/16703819971617.html
Still the same with Xcode 13.2.1 (13C100).
Oddly enough, I found that App Store accepted my app in iOS/iPadOS while it rejected the macOS version with the same core. Both of them shared the same core. So there was also a "libswift_Concurrency.dylib" in iOS version, but it was accepted.
The same issue here. However, I can get my app notarized. So just no App Store.
The error message was totally misleading. At the very beginning to debug an Apple Watch app, we should use target of the WatchKit Extension. However, I didn't know since when, to debug we should use the Watch App target instead of the WatchKit Extension.
There is no section for developer forum in bug report. And I think it is suggested to post here.
The "to" in the title should be "two".
I didn't find a solution to localized that value either. However, we could change the label value in code.
override func validateToolbarItem(in window: SFSafariWindow, validationHandler: @escaping ((Bool, String) -> Void)) {
		// This is called when Safari's state changed in some way that would require the extension's toolbar item to be validated again.
		window.getToolbarItem { (toolbarItem) in
				toolbarItem?.setImage(NSImage(named: "MonochromeIcon"))
				toolbarItem?.setLabel(NSLocalizedString("Open URL in Page By Poster 2", comment: ""))
		}
		
		validationHandler(true, "")
}
Then you can localized the text what you want.
A further investigation had shown that the issue was happened here.
arguments.completionFunction({ keyword : document.getElementsByClassName(keyword)[0].innerHTML })
There were two keywords used. arguments.completionFunction({ keyword : document.getElementsByClassName(keyword)[0].innerHTML }).
The issue was on the first keyword. It didn't convert to its value "link" but used its variable name "keyword" as the key. Maybe I should file a bug for this?
UPDATES
Just found this. https://stackoverflow.com/questions/10640159/key-for-javascript-dictionary-is-not-stored-as-value-but-as-variable-name
In fact, this was a well-known issue of how javascript interprets.
The code should changed to
arguments.completionFunction({ [keyword] : document.getElementsByClassName(keyword)[0].innerHTML })
Just using [] around keyword in key part.
I am not familiar with Javascript. But now I hate it. :(
Problem Solved!
So far, for Xcode 11 and after. The best way to test Shortcuts is using:
for Xcode 11.x with macOS 10.15.x, downloading in Xcode with 11.3 simulators. This is the best choice.
for Xcode 12 betas with macOS 11 betas, just use the latest simulator with Xcode 12. This is the second choice, as some APIs don't work in localization, but works in English. The issue also exists in iOS 14 betas real devices.(My bug issue id: FB8550556, Siri doesn't use Localized String in some API. "INIntentResolutionResult.success((with resolvedString: String) -> Self".)
Others:
simulator 11.3 doesn't work in macOS 11, either with Xcode 11 or Xcode 12.
For those who had filed issues to Apple. Did you get any replies? As this issue still exists in beta 4 now.
In my own experiences with two projects, either building from Xcode 11.6 or Xcode 12 beta 3, the issue of Realm lock file in shared group did exist on real devices. If you use the simulator, everything is fine.
Realm 5.3.2.
There is an issue on realm too. But it seams people believe it is Apple who to blame.
https://github.com/realm/realm-cocoa/issues/6671