简体   繁体   English

仅在物理设备上“尝试添加已经有父节点的 SKNode”,代码中没有错误,在模拟器上工作正常

[英]Getting 'Attemped to add a SKNode which already has a parent' only on physical device, no error in code, works fine on simulator

Running my app on a simulator works fine, however, running it on a physical device gives this error.在模拟器上运行我的应用程序可以正常工作,但是,在物理设备上运行它会出现此错误。 I understand what this error means but my code seems fine, in fact, if I get rid of the trouble code (in this case the camera) another part of the code receives the same error.我理解这个错误的含义,但我的代码看起来很好,事实上,如果我摆脱了故障代码(在这种情况下是相机),代码的另一部分会收到相同的错误。

I am targeting iOS 10.3 and running on a iOS 10.3 device, it works fine on iOS 11.0 simulator我的目标是 iOS 10.3 并在 iOS 10.3 设备上运行,它在 iOS 11.0 模拟器上运行良好

code:代码:

class GameScene: SKScene {

    var lastUpdateTime: TimeInterval = 0
    let pigeonCam: SKCameraNode = SKCameraNode()
    let pigeon: Pigeon = Pigeon()
    var dt = 0.0
    let ground: SKSpriteNode = SKSpriteNode(imageNamed: "Road")//crashes if camera and pigeon do not exist

    override func sceneDidLoad() {
        addChild(pigeonCam)//crashes
        camera = pigeonCam
        addChild(pigeon.pigeon)//crashes if camera code does not exist
        createGround()
        scene?.scaleMode = .resizeFill
    }

I have tried restarting the device unit/reinstalling the app but it appears to not help, aside from a few lines of code in 'pigeon' this is the entirety of my code in the app.我已经尝试重新启动设备单元/重新安装应用程序,但它似乎没有帮助,除了“鸽子”中的几行代码之外,这是我在应用程序中的全部代码。 I'm sure it's got to do with deployment settings or something of the like but I'm stumped我确定这与部署设置或类似的东西有关,但我很难过

I have done some research, and it is quite possible the reason this is happening is because I don't have a provisioning profile我做了一些研究,很可能发生这种情况的原因是因为我没有配置文件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试添加已存在父错误的SKNode - Attemped to add a SKNode which already has a parent error 错误:尝试添加已有父级的SKNode - Error: Attemped to add a SKNode which already has a parent 尝试添加已经有父级的SKNode - Attemped to add a SKNode which already has a parent in swift 由于未捕获的异常而导致未终止应用程序(由于未添加父节点而尝试添加一个SKNode)错误 - Terminating app due to uncaught exception due to uncaught exception (Attemped to add a SKNode which already has a parent) error 尝试添加已经具有父级的SKNode: <SKScene> 名称:&#39;(null)&#39;帧:{{0,0},{1,1}}&#39; - Attemped to add a SKNode which already has a parent: <SKScene> name:'(null)' frame:{{0, 0}, {1, 1}}' Google Maps SDK在物理设备中返回iOS错误,但在Simulator中可以正常工作 - Google Maps SDK returns iOS error in physical device but works fine in Simulator 模拟器 FirebaseAuth 有效! 但不是物理设备。 错误“令牌不匹配” - Simulator FirebaseAuth works! But not a physical device. Error 'Token Mismatch' NSURLRequest委托未在Device上被调用在模拟器上工作正常。 - NSURLRequest delegates not getting called on Device Works fine on simulator. NSDictionary…代码在模拟器上运行时效果很好,但在设备上运行时效果不佳 - NSDictionary…code works fine when run on simulator but not when run on device 解析查询包装错误,在设备上的模拟器崩溃时可以正常工作 - Parse Query Wrapping Error, works fine on simulator crashes on device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM