Re: What causes NSFileManager's stringWithFileSystemRepresentation to return nil?
Re: What causes NSFileManager's stringWithFileSystemRepresentation to return nil?
- Subject: Re: What causes NSFileManager's stringWithFileSystemRepresentation to return nil?
- From: G S <email@hidden>
- Date: Wed, 27 Oct 2010 00:06:32 -0700
Thanks for the replies, guys.
The origin of the string was an std::string, so the length calculation
should be accurate. And yes, it originally comes from a query to
determine the cache directory for my iPhone app. I'm trying to keep
as much of the app cross-platform as possible, so I'm using a lot of
std::strings and other standards.
> Using the exact string above, this works fine for me:
>
> char *cp = "/Users/me/Library/Application Support/iPhone Simulator/4.2/Applications/58BD5465-FD47-49E3-83AC-242961559F48/Library/Caches/4320_th.jpg";
> NSString *s = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:cp length:strlen(cp)];
So I did this:
char* theString = "/Users/me/Library/Application Support/iPhone
Simulator/4.2/Applications/58BD5465-FD47-49E3-83AE-242961559F48/Library/Caches/4320_th.jpg";
NSString* test = [[theApp fileManager]
stringWithFileSystemRepresentation:theString
length:strlen(theString)];
That fails; test is nil.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden