找不到符号:High Sierra 中的 _OBJC_IVAR_$_NSScroller._action

Symbol not found: _OBJC_IVAR_$_NSScroller._action in High Sierra

在以前版本的 MacOS 上运行的应用程序在 High Sierra 上失败并显示以下消息:

dyld: Symbol not found: _OBJC_IVAR_$_NSScroller._action Referenced from: Expected in: /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit

什么更改可能会导致此问题? (我不是 MacOS 开发方面的专家)我怀疑 otool 命令可能有助于识别与此问题相关的更改,但还没有找到正确的参数。

检查 AppKit 文档 https://developer.apple.com/documentation/appkit/deprecated_symbols 它说 NSDrawer 已被弃用,这是否相关?

NSDrawer [deprecated] A user interface element that contains and displays text, scroll, and browser views, in addition to other view subclasses.

我收到此错误是因为在 MacOS 版本升级后未设置活动的开发人员目录。这个目录 控制哪些工具用于 Xcode 命令行工具(例如, xcodebuild) 以及 BSD 开发命令(例如 cc 和 make)。

执行以下操作解决了我的问题:

sudo xcode-select -switch /Library/Developer/CommandLineTools/

我必须下载 Xcode(更新 Xcode)才能解决此问题。

运行 这个命令 sudo xcode-select -switch /Library/Developer/CommandLineTools/ 似乎对我不起作用。但也尝试这样做。

Catalina 升级同样的问题。

已验证旧目录...

$ xcode-select -p

> /Applications/Xcode.app/Contents/Developer

但是运行执行切换目录命令时失败:

$ xcode-select -switch /Library/Developer/CommandLineTools

> xcode-select:错误:无效的开发者目录'/Library/Developer/CommandLineTools/'

解决方案

必须执行以下操作:

  1. 安装xcode-select(这将通知xcode需要下载和安装cli开发工具)

    $ xcode-select --install
    

    > xcode-select:注意:要求安装命令行开发工具

  2. 现在,运行 切换命令 & 世界上的一切都应该恢复正常了。

    $ sudo xcode-select -switch /Library/Developer/CommandLineTools/
    
  3. 利润

希望对您有所帮助。

今天我从 high sierra 升级到 macOS Catalina 时遇到了完全相同的问题。

对我有用的是,

1) 安装命令行工具

xcode-select --install

2) 更新活动开发者目录路径

sudo xcode-select --switch /Library/Developer/CommandLineTools/

对我有用的是:sh-3.2# /usr/bin/xcode-select -switch /Library/Developer/CommandLineTools/