现在我正在开发一个基于SKScene
. 而且我想将一些存储SKShapeNode
到系统默认值,以便用户在完全关闭后重新打开应用程序时仍然可以看到它们。我存储SKShapeNodes
在一个NSMutableDictionary
. 我试图将它存储起来NSUserDefault
使用setObjectForKey
,但它给了我错误:
Property list invalid for format: 200 (property lists cannot contain objects of type 'CFType')
.
因为我正在尝试添加SKShapeNode
它。那么我怎样才能像这样存储它NSUserDefault
呢?非常感谢!!
这是我的代码: 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 = 否;myNode.physicsBody.dynamic = YES; myNode.physicsBody.restitution = 0.3; [mainLists myNode forKey:someKey];(mainList 是一个 nsdictionary) NSUserDefault *store = [NSUserDefault standardDefault]; [store setObject:mainList forKey:@"mainList"]; [存储同步];