CFURLCopyResourcePropertyForKey failed because it was passed this URL which has no scheme:

后端 未结 7 2163
灰色年华
灰色年华 2021-01-30 11:10

I understand this is an xcode warning/error, however, it happens when I try to run gitk --all from the command line.

YuFei-Zhus-MacBook-Pro:test phi         


        
7条回答
  •  [愿得一人]
    2021-01-30 11:33

    I got this error just now and find a solution to solve it.

    I was trying to invoke the function getResourceValue:forKey:error: in my project and my os version is 10.7.5.

    I init a new NSURL object by using + URLWithString: and the problem occurred before, after I replace it with + fileURLWithPath:, it's ok now.

    The difference value between the two objects with different functions is /Volumes/Data/a file://localhost/Volumes/Data/a/

    Apple has statemented that about NSURL class below,

    Handling Object Creation Failure The NSURL class fails to create a new NSURL object if the path being passed is not well-formed; the path must comply with RFC 2396. Examples of cases that will not succeed are strings containing space characters and high-bit characters. Should creating an NSURL object fail, the creation methods return nil, which you must be prepared to handle. If you are creating NSURL objects using file system paths, you should use fileURLWithPath: or initFileURLWithPath:, which handle the subtle differences between URL paths and file system paths. If you wish to be tolerant of malformed path strings, you’ll need to use functions provided by the Core Foundation framework to clean up the strings.

    Error while using getResourceValue:forKey method in NSURL

提交回复
热议问题