cocoa - Why I cannot get the right path with NSURL (swift) -
it situation when use
nsopenpanel
and
nsurl
to open file path string coding swift. path should
"/users/yy/downloads/chs16.fon"
but got
"p\xab\xe2w\xff\x7f"
, , don't know why.
p.s. top left hollow circle small bug too, have connected action button.
nsopenpanel return nsurl, filehandleforreadingatpath need string, i've solve this function , works me :
func nsurltostring (nsurlinit:nsurl) -> string { var nsurlproperty:nsurl = nsurlinit var urlstring:string = nsurlproperty.absolutestring! urlstring.removerange(urlstring.startindex..<advance(urlstring.startindex, +7)) return urlstring }
Comments
Post a Comment