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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/davedelong%40me.com
> 
> This email sent to davedel...@me.com

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

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to