• 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: NSString / NSURL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString / NSURL


  • Subject: Re: NSString / NSURL
  • From: Dave DeLong <email@hidden>
  • Date: Sat, 28 Aug 2010 09:08:18 -0600

Oh duh.  imagePath is an NSURL, because defaultImageLocation is an NSURL, and stringByAppendingPathComponent: is an NSString method.

Dave

On Aug 28, 2010, at 9:03 AM, Dave DeLong wrote:

> This is incorrect:
>
>> NSString* fileName= [filePath lastPathComponent];
>> 		NSMutableString* imagePath;
>> 		imagePath = defaultImageLocation;
>>
>> 		[imagePath stringByAppendingPathComponent:fileName];
>>
>> 		[[ NSFileManager defaultManager ] copyItemAtPath:filePath toPath:imagePath error:nil];
>> 		[Product setValue:imagePath forKey:@"productImage"];
>
> Just because you declare a pointer to an NSMutableString does not mean you actually have an NSMutableString.  In this case, you have an NSString (since defaultImageLocation is a immutable string).  Also, you're ignoring the return value of stringByAppendingPathComponent:, so after that method invocation, imagePath is still equivalent to defaultImageLocation.
>
> I'm guessing that it's failing because you're trying to copy a file (at filePath) to the location of a directory (imagePath).
>
> Dave_______________________________________________
>
> 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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >NSString / NSURL (From: Amy Heavey <email@hidden>)
 >Re: NSString / NSURL (From: Dave DeLong <email@hidden>)

  • Prev by Date: Re: NSString / NSURL
  • Next by Date: Re: NSString / NSURL
  • Previous by thread: Re: NSString / NSURL
  • Next by thread: Re: NSString / NSURL
  • Index(es):
    • Date
    • Thread