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

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

问题描述

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

然后我在项目中添加了watchOS目标,设置为游戏"

文件>新建>目标:

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

    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
        }
    }

不幸的是,我似乎无法在Apple Watch Simulator上安装它.

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

  • 清理构建等
  • 卸载/重新安装
  • 已检查的info.plist 此处
  • 从配对的iOS Apple Watch App在iPhone模拟器中安装(只是没有安装),
  • 按照 raywenderlich watchOS教程中的建议,甚至添加了用户定义的项目设置...

我什至无法安装它或出现在Apple Watch上.我在做什么?

更新

我已将iOS App的Deployment Target调整为10.0,终于可以从iPhone Simulator中的Apple Watch应用程序中安装它了,除了从Apple Watch Simulator中启动Apple Watch App之后,我得到了以下内容:错误:

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) 

此错误是什么意思?不应加载任何图片,因为它是默认的SpriteKit测试...

解决方案

可能不是真正的解决方案,但是经过数小时尝试各种尝试后发现的解决方法

将否"更改为是":

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

你好,世界!"应该出现在Apple Watch上,带有一个旋转的,脉冲状的spriteNode(未在屏幕快照中显示,因为捕获速度不够快).

请注意,您可能需要通过启动Apple Watch App,单击您的应用程序并按在Apple Watch上显示",从iPhone Simulator的Apple Watch App中安装该应用程序.

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:

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 Game-libswiftSwiftOnoneSupport错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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