• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: What causes NSFileManager's stringWithFileSystemRepresentation to return nil?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: What causes NSFileManager's stringWithFileSystemRepresentation to return nil?
      • From: Graham Cox <email@hidden>
References: 
 >What causes NSFileManager's stringWithFileSystemRepresentation to return nil? (From: G S <email@hidden>)
 >Re: What causes NSFileManager's stringWithFileSystemRepresentation to return nil? (From: Andy Lee <email@hidden>)

  • Prev by Date: Re: NSFileManager and Resource Forks
  • Next by Date: Re: What causes NSFileManager's stringWithFileSystemRepresentation to return nil?
  • Previous by thread: Re: What causes NSFileManager's stringWithFileSystemRepresentation to return nil?
  • Next by thread: Re: What causes NSFileManager's stringWithFileSystemRepresentation to return nil?
  • Index(es):
    • Date
    • Thread