Now I am working on an app based on SKScene
. And I want to store some SKShapeNode
to system defaults so user can still see them when reopening the app after it is totally closed. I store the SKShapeNodes
in a NSMutableDictionary
. I tried to store it to NSUserDefault
using setObjectForKey
but it gave me the error:
Property list invalid for format: 200 (property lists cannot contain objects of type 'CFType')
.
Because I am trying to add SKShapeNode
to it. So how can I store it like the way of NSUserDefault
? Thanks so much!!
Here is my code: myNode = [SKShapeNode shapeNodeWithCircleOfRadius:radius]; [myNode setPhysicsBody:[SKPhysicsBody bodyWithCircleOfRadius:radius]]; myNode.fillColor = [uicolor greenColor]; myNode.lineWidth = 1.0; [myNode setPosition:positionInScene1]; myNode.antialiased = YES; myNode.glowWidth = 0.0; myNode.physicsBody.allowsRotation = NO; myNode.physicsBody.dynamic = YES; myNode.physicsBody.restitution = 0.3; [mainLists myNode forKey:someKey];(mainList is a nsdictionary) NSUserDefault *store = [NSUserDefault standardDefault]; [store setObject:mainList forKey:@"mainList"]; [store sychronize];