Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems with NSKeyedArchiver- Simply does not archive at all!
    primarykey
    data
    text
    <p>I am probably not seeing something here, that is why I am asking for help :) Here is the deal I have a NSMutable array of items that fulfill the NSCoding protocol, but NSKeyedArchiver always fails to archive it... here is my object implementation:</p> <pre><code>@implementation YTVideo @synthesize URL,thumb,titulo; #pragma mark NSCoding #define kTituloKey @"titulo" #define kURLKey @"URL" #define kThumbKey @"thumb" -(id)initWithData:(NSString *)ktitle :(UIImage *)kThumb :(NSURL *)kURL{ self.titulo = ktitle; self.thumb = kThumb; self.URL = kURL; return self; } - (void) encodeWithCoder:(NSCoder *)encoder { [encoder encodeObject:titulo forKey:kTituloKey]; [encoder encodeObject:URL forKey:kURLKey]; NSData *thumbData = UIImagePNGRepresentation(thumb); [encoder encodeObject:thumbData forKey:kThumbKey]; } - (id)initWithCoder:(NSCoder *)decoder { NSString* ktitulo = [decoder decodeObjectForKey:kTituloKey]; NSURL* kURL = [decoder decodeObjectForKey:kURLKey]; NSData* kThumbdata = [decoder decodeObjectForKey:kThumbKey]; UIImage* kThumb=[UIImage imageWithData:kThumbdata]; return [self initWithData:ktitulo:kThumb:kURL]; } @end </code></pre> <p>During the program execution I have a NSMutable array of those objects called videosArray.</p> <p>then, eventually, I try:</p> <pre><code>NSString* path =[NSHomeDirectory() stringByAppendingPathComponent:@"teste.wrapit"]; NSLog(@"PATH =%@",path); bool teste = [NSKeyedArchiver archiveRootObject:videosArray toFile:path]; NSLog(@"aramzenamento:%@",teste ? @"sucesso!" :@"Nope"); BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:path]; NSLog(@"Arquivo armazenado existe?%@",fileExists ?@"Sim":@"Nao"); </code></pre> <p>And I always get a fail on my boolean checks... Any Ideas where I am completely wrong?? Thanks!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload