Copying an SKNode doesn't copy the userData property
| Originator: | balazsfaludi | ||
| Number: | rdar://14292750 | Date Originated: | 27-Jun-2013 08:36 PM |
| Status: | Open | Resolved: | |
| Product: | OS X SDK | Product Version: | 10.9 DP1 |
| Classification: | Enhancement | Reproducible: | Always |
Summary:
When copying an SKNode, the NSMutableDictionary userData property doesn't seem to be copied. I would expect this to happen. If this is by design, you should really put a warning in the documentation (I couldn't find anything).
Steps to Reproduce:
In a Sprite Kit project run this code:
// Assuming Spaceship.png is part of the project.
SKSpriteNode *original = [SKSpriteNode spriteNodeWithImageNamed:@"Spaceship"];
original.userData = [@{@"key1" : @"value1"} mutableCopy];
NSLog(@"Original userData: %@", original.userData);
SKSpriteNode *copied = [original copy];
NSLog(@"Copied userData: %@", copied.userData);
Expected Results:
The copied node is an exact copy of the original, including the userData dictionary.
Actual Results:
The userData dictionary seems to be nil. Output of the above code:
2013-06-27 20:35:50.977 CopyTest[88781:303] Original userData: {
key1 = value1;
}
2013-06-27 20:35:50.977 CopyTest[88781:303] Copied userData: (null)
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!