- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
更新到 Mojave 后出现奇怪的崩溃。
没有做任何特别的事情,只是创建一个 NSWindow 并调用 orderFrontRegardless
之前一直运行良好。
1 libsystem_platform.dylib 0x00007fff6610ab5d _sigtramp + 29
2 ??? 0x0000000000000000 0x0 + 0
3 CoreFoundation 0x00007fff39b00bb6 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
4 CoreFoundation 0x00007fff39b00b30 ___CFXRegistrationPost_block_invoke + 63
5 CoreFoundation 0x00007fff39b00a9a _CFXRegistrationPost + 404
6 CoreFoundation 0x00007fff39b08f48 ___CFXNotificationPost_block_invoke + 87
7 CoreFoundation 0x00007fff39a71994 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1642
8 CoreFoundation 0x00007fff39a70d47 _CFXNotificationPost + 732
9 Foundation 0x00007fff3bdab217 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
10 AppKit 0x00007fff3720538b -[NSWindow _setFrameCommon:display:stashSize:] + 3090
11 AppKit 0x00007fff37204766 -[NSWindow _setFrame:display:allowImplicitAnimation:stashSize:] + 192
12 AppKit 0x00007fff3720469f -[NSWindow setFrame:display:] + 51
13 AppKit 0x00007fff3727aca9 -[NSWindow _reallyDoOrderWindowAboveOrBelow:relativeTo:findKey:forCounter:force:isModal:] + 1336
14 AppKit 0x00007fff372792a0 -[NSWindow _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 283
15 AppKit 0x00007fff37a0dce9 -[NSWindow orderFrontRegardless] + 40
代码(这是一个控制台应用程序):
NSWindow *window = [[NSWindow alloc] initWithContentRect:windowRect
styleMask:windowStyle
backing:NSBackingStoreBuffered
defer:NO];
// Since Snow Leopard, programs without application bundles and Info.plist
// files don't get a menubar and can't be brought to the front unless the
// presentation option is changed
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
[NSApp activateIgnoringOtherApps:YES];
[window makeKeyAndOrderFront:nil];
最佳答案
如何初始化应用程序?在使用 AppKit
之前,您是否已初始化 NSApplication
?
像这些步骤在 main.m 中应该是必要的:
@autoreleasepool {
NSApplication* application = NSApplication.sharedApplication;
AppDelegate* delegate = [[AppDelegate alloc] init];
application.delegate = delegate;
[application run];
}
您的委托(delegate)也可能会被释放,因为 NSApp
持有对它的弱引用。
关于objective-c - 更新到 macOS Mojave 后 [NSWindow orderFrontRegardless] 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54754830/
升级到 macOS Mojave 后,我尝试从终端运行 GIT,但它一直给我以下错误: xcrun: error: invalid active developer path (/Library/De
我有一个在 10.9 及更高版本上运行的 macOS 应用程序,它允许用户在其联系人(又名地址簿)中“查找”人员,例如:[ABAddressBook 共享AddressBook] 在 10.14 之前
我发现 macOS Mojave Beta 中的默认(也是唯一)动态壁纸位于/Library/Desktop Pictures/中。有问题的文件称为“Mojave (Dynamic).heic” 我想
我正在尝试通过画外音测试我的 MacOS Mojave 上某个页面的可访问性。我必须能够通过快捷键 Command + F5 打开和关闭语音。 但是快捷方式不起作用。 知道为什么吗? 最佳答案 我找到
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 2年前关闭。 Improve thi
我有一个脚本,我定期运行以使用 Applescript 打开/关闭灰度。它在 High Sierra 上运行良好,但当我在 Mojave 使用它时抛出异常。 tell application "Sys
我有一个非常基本的小命令行应用程序,可以在下次单击鼠标时获取鼠标坐标。 #import #import CGEventRef myCGEventCallback(CGEventTapProxy p
Building native extensions. This could take a while... ERROR: Error installing libxml-ruby: ERR
我刚刚做了Brew update mysql,然后关闭了我的mysql。 尝试重新开始,然后砰: ~ » mysql.server start
我知道这不太可能是正确的询问地点,但我不知道应该问哪里。 所以我有一台 2016 年的普通 macbook。我安装了 Android Studio 几个月,并且可以正常使用很长时间。现在升级到 Moj
最近我更新了 Mojave 并在访问 git 命令时收到以下错误消息: xcrun: error: invalid active developer path (/Library/Developer/
我的 mac 经常向我发送磁盘空间不足的警报。当我检查系统存储时,它显示系统占用了 170+gb。我不确定我的空间在哪里被使用? 我也尝试了一些更清洁的工具,但无法获得太多帮助。 请帮忙解决一下? 最
我做了这些步骤: 更新到 Mojave 已安装 Xcode 10 beta3 运行此命令:sudo xcode-select -switch /Applications/Xcode-beta.app/
我正在运行 MacOS 10.14.6 并希望将 XCode 安装到/Applications 文件夹中。 尝试使用 Appstore 下载它时,收到错误消息“无法安装 Xcode,因为需要 macO
我正在编写一个应用程序,允许用户设置 macOS Mojave 的强调色。 我的第一次尝试是使用 AppleScript。但我意识到 API 还不是最新的: 带下划线的 API 可以工作,但它只有 2
以下代码在 Mojave 中不再有效: if let url = URL(string: "https://apple.com"), let listService = NSSharingSe
我正在 macOs Mojave 上安装“THERMUS:ROOT 的热模型包”。其中一个步骤是(解压后)如下:“设置一个环境变量‘THERMUS’指向包含 THERMUS 代码的顶级目录”。我真的不
在 macOS Mojave 10.14.1 中启动 ./build/nodes/deployNodes 时,终端会打开但不会启动与 deployNodes 中定义的每个节点对应的选项卡> Gradl
我在App Store中以如下一行显示所有macOS应用程序: NSString *finalLink = @"http://appstore.com/mac/JiulongZhao" [[NSWor
我正在 macOs Mojave 上安装“THERMUS:ROOT 的热模型包”。其中一个步骤是(解压后)如下:“设置一个环境变量‘THERMUS’指向包含 THERMUS 代码的顶级目录”。我真的不
我是一名优秀的程序员,十分优秀!