在 Apple Watch Simulator(xCode 8、Swift 3、iOS 10)上的 watchOS 中运行 SpriteKit 游戏 - libswiftSwiftOnoneSupport 错误 [英] Running SpriteKit Game in watchOS on Apple Watch Simulator (xCode 8, Swift 3, iOS 10) - libswiftSwiftOnoneSupport Error

查看:21
本文介绍了在 Apple Watch Simulator(xCode 8、Swift 3、iOS 10)上的 watchOS 中运行 SpriteKit 游戏 - libswiftSwiftOnoneSupport 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了 xCode 8.0 beta 并打开了一个最近用 swift 2 编写的项目,然后我使用 xCode 将其转换为 swift 3.>

然后我将一个 watchOS 目标添加到我的项目中,设置为game"

文件>新建>目标:

我检查了 WatchExtension 中的 GameScene.swift 并确定所有代码都在那里并设置了一个场景:

 导入 SpriteKit类 GameScene:SKScene {私有 var spinnyNode :SKShapeNode?覆盖 func sceneDidLoad() {if let label = self.childNode(withName: "//helloLabel") as?SKLabelNode {标签.alpha = 0.0label.run(SKAction.fadeIn(withDuration: 2.0))}让 w = (self.size.width + self.size.height) * 0.05让 spinnyNode = SKShapeNode(rectOf: CGSize(width: w, height: w),cornerRadius: w * 0.3)spinnyNode.position = CGPoint(x: 0.0, y: 0.0)spinnyNode.strokeColor = UIColor.red()spinnyNode.lineWidth = 8.0spinnyNode.run(SKAction.sequence([SKAction.wait(forDuration: 0.5),SKAction.fadeOut(withDuration: 0.5),SKAction.removeFromParent()]))spinnyNode.run(SKAction.repeatForever(SKAction.rotate(byAngle: 6.28, duration: 1)))self.run(SKAction.repeatForever(SKAction.sequence([SKAction.wait(forDuration: 2.0),SKAction.run({让 n = spinnyNode.copy() 作为!SKShapeNodeself.addChild(n)})]))))}覆盖 func 更新(_ currentTime:TimeInterval){//在渲染每一帧之前调用}}

很遗憾,我似乎无法在 Apple Watch Simulator 上安装它.

我已经尝试了所有我能想到的方法,包括:

  • 清理构建等
  • 卸载/重新安装,
  • 检查 info.plist

    请注意,您可能需要通过启动 Apple Watch 应用程序,点击您的应用程序,然后按在 Apple Watch 上显示",从 iPhone 模拟器从 Apple Watch 应用程序安装该应用程序.

    I downloaded xCode 8.0 beta and opened a recent project written in swift 2 which I then converted to swift 3 using xCode.

    I then added a watchOS target to my project with the setting "game"

    File > New > Target:

    I checked the GameScene.swift in the WatchExtension and sure enough all the code is there and sets up a scene:

        import SpriteKit
    
        class GameScene: SKScene {
    
            private var spinnyNode : SKShapeNode?
    
            override func sceneDidLoad() {
    
                if let label = self.childNode(withName: "//helloLabel") as? SKLabelNode {
                    label.alpha = 0.0
                    label.run(SKAction.fadeIn(withDuration: 2.0))
                }
    
                let w = (self.size.width + self.size.height) * 0.05
                let spinnyNode = SKShapeNode(rectOf: CGSize(width: w, height: w), cornerRadius: w * 0.3)
    
                spinnyNode.position = CGPoint(x: 0.0, y: 0.0)
                spinnyNode.strokeColor = UIColor.red()
                spinnyNode.lineWidth = 8.0
    
                spinnyNode.run(SKAction.sequence([SKAction.wait(forDuration: 0.5),
                                                  SKAction.fadeOut(withDuration: 0.5),
                                                  SKAction.removeFromParent()]))
    
                spinnyNode.run(SKAction.repeatForever(SKAction.rotate(byAngle: 6.28, duration: 1)))
    
                self.run(SKAction.repeatForever(SKAction.sequence([SKAction.wait(forDuration: 2.0),
                                                                   SKAction.run({
                                                                    let n = spinnyNode.copy() as! SKShapeNode
                                                                    self.addChild(n)
                                                                   })])))
            }
    
    
            override func update(_ currentTime: TimeInterval) {
                // Called before each frame is rendered
            }
        }
    

    Unfortunately I can't seem to get this to install on the Apple Watch Simulator.

    I've tried everything I can think of, including:

    • Clean builds, etc
    • Uninstall/reinstall,
    • Checked info.plist for common errors,
    • Created a new simulator with paired Apple Watch using Add Additional Simulators,
    • Added Skip Install = No, suggested here,
    • Install from Paired iOS Apple Watch App in iPhone Simulator (just doesn't install),
    • Even added user defined project settings, as suggested in a raywenderlich watchOS tutorial...

    I just can't get it to even install or appear on the Apple Watch. what am I not doing?

    UPDATE

    I have adjusted the Deployment Target to 10.0 for the iOS App and I was finally able to install it from the Apple Watch app in the iPhone Simulator, except upon launching the Apple Watch App from the Apple Watch Simulator, I get the following error:

    dyld: Library not loaded: @rpath/libswiftSwiftOnoneSupport.dylib
    Referenced from: /Users/MYNAME/Library/Developer/CoreSimulator/Devices/XXXXXX-XXXX-XXXX-XXXX/data/Containers/Bundle/Application/XXXXXX-XXXX-XXXX-XXXX/MYAPPNAME.app/PlugIns/MYAPPWATCH Extension.appex/MYAPPWATCH Extension
    Reason: image not found
    (lldb) 
    

    What does this error mean? There shouldn't be any images to load as it's the default SpriteKit test...

    解决方案

    Probably not the real solution, but a work around that I found after hours of trying various things was found here, on Stackoverflow, for the Error occurring at the bottom of my question above.

    So if you convert your App to Swift 3.0, Add a watchOS "game" Target to your project, change iOS Deployment Target to 10.0 and run on WatchOS 3.0 Simulator and iPhone 6s iOS 10 Simulator, update the following setting:

    Change NO to YES:

    Project > Targets > App Name > Embed Asset Packs In Product Bundle = YES
    

    And "Hello, World!" should appear on the Apple Watch, with a spinning, pulsing spriteNode (not shown in screenshot as didn't capture it quick enough).

    Please note, you may have to install the App from the Apple Watch App from the iPhone Simulator by launching the Apple Watch App, clicking your app, and pressing "show on Apple Watch".

    这篇关于在 Apple Watch Simulator(xCode 8、Swift 3、iOS 10)上的 watchOS 中运行 SpriteKit 游戏 - libswiftSwiftOnoneSupport 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆