NSUrl from NSString returns null
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to parse the location of my Documents Directory to NSUrl from NSString I have. when my console NSLog(stringURL) i get: "/var/mobile/Applications/2B35D06D-6E4A-40F2-833E-28463A946834/Library/Application Support/MyAppDirectory" as an output. but when I do NSURL* url = [NSURL URLWithString:stringUrl]; and NSLog(url) i get (null) as an output. WHat am I doing wrong here? 回答1: From the apple documentation "An NSURL object initialized with URLString. If the URL string was malformed or nil, returns nil." Your stringURL isn't a correct formed