简体   繁体   中英

Spritekit SKPhysicsBody crash on ios7 during on ios8 working

Im forcing strange issue with SKPhysicsBody, i made game with ios8 sdk but fully compatible with old ios7. When im trying to execute this on ios7 i got crash with error.

pathToDraw = CGPathCreateMutable();
CGPathMoveToPoint(pathToDraw, NULL, positionInScene.x, positionInScene.y);
lineNode = [SKShapeNode node];
lineNode.path = pathToDraw;
lineNode.physicsBody = [SKPhysicsBody bodyWithEdgeChainFromPath:pathToDraw]; <<crashes here

error:

Assertion failed: (count >= 2), function CreateChain, file /SourceCache/PhysicsKit_Sim/PhysicsKit-6.5.4/PhysicsKit/Box2D/Collision/Shapes/b2ChainShape.cpp, line 45.

On iOS8 app working great. Problem occurs only on iOS 7

Your path only contains a single point. Since this is crashing only in iOS 7 I would assume that iOS 8 considers this as a special case and presumably completes the path by using the node's position as the other point. Regardless of that, if you want to make it compatible with iOS 7 you'll always have to create the path with two points.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM