41

我知道这是一个 xcode 警告/错误,但是,当我尝试从命令行运行时会发生这种情况gitk --all

YuFei-Zhus-MacBook-Pro:test phil88530$ gitk --all
2012-08-02 21:14:49.246 Wish[33464:707] CFURLCopyResourcePropertyForKey failed because it was passed this URL which has no scheme: 
2012-08-02 21:14:49.252 Wish[33464:707] CFURLCopyResourcePropertyForKey failed because it was passed this URL which has no scheme: 
2012-08-02 21:14:49.293 Wish[33464:707] CFURLCopyResourcePropertyForKey failed because it was passed this URL which has no scheme: 
2012-08-02 21:14:49.295 Wish[33464:707] CFURLCopyResourcePropertyForKey failed because it was passed this URL which has no scheme: 
2012-08-02 21:14:49.474 Wish[33464:707] CFURLCopyResourcePropertyForKey failed because it was passed this URL which has no scheme: 
2012-08-02 21:14:49.476 Wish[33464:707] CFURLCopyResourcePropertyForKey failed because it was passed this URL which has no scheme: 
2012-08-02 21:14:50.731 Wish[33464:707] CFURLCopyResourcePropertyForKey failed because it was passed this URL which has no scheme: 
2012-08-02 21:14:50.734 Wish[33464:707] CFURLCopyResourcePropertyForKey failed because it was passed this URL which has no scheme: 
YuFei-Zhus-MacBook-Pro:test phil88530$ 

我刚刚更换了一个新磁盘并重新安装了 osx 并更新到山狮,安装了 x11 和 xcode。有什么建议为什么会发生这种情况?

4

7 回答 7

25
$ alias gitk='gitk 2>/dev/null'

我在这里有同样的问题。在有人回答此解决方案之前,这是一个快速提示。

于 2012-08-10T06:48:17.397 回答
8

如果您是 MacPorts 用户,请将 tcl/tk 升级到 8.6.0:

$ sudo port install tcl tk
于 2013-03-01T11:55:26.430 回答
7

我刚刚收到此错误并找到解决方案。

我试图在我的项目中调用函数 getResourceValue:forKey:error: 并且我的操作系统版本是 10.7.5。

我使用 + 初始化了一个新的 NSURL 对象,URLWithString:之前出现了问题,在我用 + 替换它之后fileURLWithPath:,现在可以了。

不同功能的两个对象的差值是/Volumes/Data/a file://localhost/Volumes/Data/a/

苹果在下面声明了关于 NSURL 类:

处理对象创建失败 如果传递的路径格式不正确,则 NSURL 类无法创建新的 NSURL 对象;路径必须符合 RFC 2396。不成功的例子是包含空格字符和高位字符的字符串。如果创建 NSURL 对象失败,创建方法返回 nil,您必须准备好处理它。如果你使用文件系统路径创建 NSURL 对象,你应该使用 fileURLWithPath: 或 initFileURLWithPath:,它们处理 URL 路径和文件系统路径之间的细微差别。如果您希望容忍格式错误的路径字符串,则需要使用 Core Foundation 框架提供的函数来清理字符串。

于 2012-11-19T08:45:24.763 回答
7

用新版本的 tcl-tk 运行 gitk 似乎可以解决这个问题(用 Mac OS X 10.8.4 测试)。如果您安装了 Homebrew,以下应该可以工作:

  1. 从命令行运行:brew install tcl-tk
  2. 然后将以下内容添加到您的 .bashrc 或 .bash_profile 中:alias gitk='"$(brew --prefix tcl-tk)/bin/wish" "$(which gitk)"'

重新启动终端后,您应该能够正常运行 gitk 而不会看到任何“CFURLCopyResourcePropertyForKey”错误。

于 2013-07-25T23:56:11.470 回答
3

在 Mountain Lion 10.8.2 上,我修复了安装/升级 tcl 和 tk 的问题——正如 tair 所述。

酿造安装 tcl
酿造安装 tk

gitk 的 UI 可能会改变,但你可以在 ~/.gitk 中调整它。

于 2013-03-28T14:20:41.127 回答
1

这篇博文解决了我的问题:

http://blog.jasonsemko.com/post/51668282398/easy-fix-for-cfurlcopyresourcepropertyforkey-failed

总而言之,它gitk没有正确解析 Xcode 附带的 git 版本字符串,并且正在吐出额外的细节。

所以要修复,你可以安装一个带有干净版本号的 git。

brew install git

您可能需要确保通过更改在您中搜索的顺序目录来调用 brew 的 git 版本(例如,我必须在之前PATH加载)。或者,您可以将 git 别名为 brew 安装的绝对路径。/usr/bin/local/usr/bin

于 2013-10-28T23:09:25.170 回答
0

别名 gk='gitk --all 2> /dev/null &' (我在 mac 上)

我在 ~/.bash_login 文件中有它,它解决了它:D

你也可以把它放在 .bashrc 文件中

于 2012-09-25T21:05:00.653 回答