• 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: Unarchive Data from URL (was Can't Convert Image...)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Subject: Re: Unarchive Data from URL (was Can't Convert Image...)
  • From: Timothy Larkin <email@hidden>
  • Date: Wed, 31 Aug 2005 06:40:55 -0400

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:

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: 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>)

  • Prev by Date: Re: NSSegmentedControl and Bindings
  • Next by Date: Re: Tableviews like Excel ones
  • Previous by thread: Unarchive Data from URL (was Can't Convert Image...)
  • Next by thread: hyperlinktext cursor is not changing untill focus on textview
  • Index(es):
    • Date
    • Thread