Can't instantiate NSURL with file path
When creating an NSURL with [NSURL fileURLWithPath:[@"~/Movies" stringByExpandingTildeInPa开发者_StackOverflow中文版th]]
, I get following error in the console:
-[NSURL initWithScheme:host:path:]: path file:/localhost/Users/michael is not absolute.
It worked while compiling in Debug mode, this problem occured only after switching to Release.
EDIT: Just to clarify, I get the error message at run time when the NSURL object is initialized, not while building.
I think your code needs to look like:
NSURL *url = [NSURL fileURLWithPath:[@"~/Movies" stringByExpandingTildeInPath]];
Looks to me like you are missing the @"" that needs to surround '~/Movies'.
works fine here ...
NSURL *url = [NSURL fileURLWithPath:[@"~/Movies" stringByExpandingTildeInPath]];
NSLog(@"url: %@", url);
BUT is your app sandboxed in release mode? That could explain this
精彩评论