CFURLCopyResourcePropertyForKey失败,因为它传递了这个没有方案的URL:

phi*_*530 39 git macos terminal xcode command-line

我知道这是一个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$ 
Run Code Online (Sandbox Code Playgroud)

我刚刚更换了一个新磁盘并重新安装了osx并更新到了山狮,安装了x11和xcode.有什么建议为什么会这样?

小智 24

$ alias gitk='gitk 2>/dev/null'
Run Code Online (Sandbox Code Playgroud)

我这里有同样的问题.这是快速提示,直到有人回答此解决方案.

  • *注意:这只是隐藏错误消息**别名只是将gitk的stderr输出(文件设备2)重定向到/ dev/null,从而永远屏蔽gitk生成的所有错误.可能不是什么大不了的事,但如果你使用它,你应该知道它在做什么. (20认同)

Tai*_*air 8

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

$ sudo port install tcl tk
Run Code Online (Sandbox Code Playgroud)


mon*_*oos 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"错误.

  • 你可能不得不在'brew install tcl-tk`之前运行`brew tap homebrew/dupes`,如果你还没有这样做的话. (3认同)

Ita*_*chi 5

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

我试图调用函数getResourceValue:forKey:error:在我的项目中,我的os版本是10.7.5.

我使用+ URLWithString初始化一个新的NSURL对象:问题发生之前,我用+ fileURLWithPath:替换后,现在没关系.

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

Apple已经声明了下面的NSURL类,

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

在NSURL中使用getResourceValue:forKey方法时出错


phi*_*530 0

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

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

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