Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unarchive Data from URL (was Can't Convert Image...)



I think the problem is that you have created a data object, but not an archive, which constitutes another layer around the data object. You need to invoke NSArchiver on the object before you can unarchive it. Something like this

[self setValue:[NSArchiver archivedDataWithRootObject:data] forKey:@"image"];

On Aug 30, 2005, at 2:27 PM, Ian G. Gillespie wrote:

When I create an NSData object from a URL and set the data for a Core Data entity's attributes I got this error:
+[NSUnarchiver unarchiveObjectWithData:]: extra data discarded


This is my code:

-(void)setImagePath:(NSURL *)path {
NSLog([path className]); //just to check that I am actually getting a URL (could come from an AppleScript)
NSData *data = [NSData dataWithContentsOfURL:path];
[self setValue:data forKey:@"image"];
}
Dp Does anyone know why this is happening when it is unarchived?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Can't Convert Image on Disk to NSData for Core Data (From: "Ian G. Gillespie" <email@hidden>)
 >Unarchive Data from URL (was Can't Convert Image...) (From: "Ian G. Gillespie" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.