Hi all,
I'm having trouble in trying to access the content of a sprite kit particle file in a way that conforms with the recent deprecation of several functions in NSKeyedArchiver.
Briefly, my project contains a file named "ParticleSmoke.sks", which I used to access easily with the following lines of code:
NSString *smokePath = [[NSBundle mainBundle] pathForResource:@"ParticleSmoke" ofType:@"sks"];
SKEmitterNode* smoke = [NSKeyedUnarchiver unarchiveObjectWithFile:smokePath];
now that the unarchiving function has been deprecated, I fail to use the (poorly documented) unarchivedObjectOfClass function. Especially, the code below returns nil.
NSString *smokePath = [[NSBundle mainBundle] pathForResource:@"ParticleSmoke" ofType:@"sks"];
NSData* smokeData = [NSData dataWithContentsOfFile:smokePath];
NSError* error=nil;
Class cls = [SKEmitterNode class];
SKEmitterNode* smoke = (SKEmitterNode*)[NSKeyedUnarchiver unarchivedObjectOfClass:cls fromData:smokeData error:&error];
Unexpectedly, the content of "error" (code 4864) was
@"NSDebugDescription" : @"value for key 'NS.objects' was of unexpected class 'NSColor'. Allowed classes are '{(\n SKKeyframeSequence,\n NSArray,\n NSNumber,\n NSMutableArray\n)}'."
Has anyone an idea to fix this issue?
Thanks for your help....