cocoa - Why I cannot get the right path with NSURL (swift) -


debug info

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

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -