在Apple Watch模拟器(xCode 8,Swift 3,iOS 10)上的watchOS中运行SpriteKit游戏-LibSwiftsWiftOneSupport错误
我下载了在Apple Watch模拟器(xCode 8,Swift 3,iOS 10)上的watchOS中运行SpriteKit游戏-LibSwiftsWiftOneSupport错误,xcode,swift,sprite-kit,apple-watch,watchos,Xcode,Swift,Sprite Kit,Apple Watch,Watchos,我下载了xcode8.0beta,打开了一个用swift2编写的最新项目,然后使用xCode将其转换为swift3 然后我在我的项目中添加了一个watchOS目标,设置为“game” 文件>新建>目标: 我检查了Watch Extension中的GameSecene.swift,确定所有代码都在那里并设置了一个场景: import SpriteKit class GameScene: SKScene { private var spinnyNode : SK
xcode8.0beta
,打开了一个用swift2
编写的最新项目,然后使用xCode将其转换为swift3
然后我在我的项目中添加了一个watchOS
目标,设置为“game”
文件>新建>目标:
我检查了Watch Extension
中的GameSecene.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模拟器上
我已经尝试了我能想到的一切,包括:
- 整洁的建筑等
- 卸载/重新安装
- 选中info.plist
- 使用
,与成对的Apple Watch创建了一个新的模拟器添加其他模拟器
- 添加了跳过安装=否,建议
- 从iPhone模拟器中配对的iOS Apple Watch应用程序安装(只是不安装)
- 甚至添加了用户定义的项目设置,如watchOS教程中所建议的
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测试…可能不是真正的解决方案,但我在尝试了数小时的各种事情后发现了一个解决方案,因为上面问题的底部出现了错误 因此,如果您将应用程序转换为Swift 3.0,将watchOS“游戏”目标添加到项目中,将iOS部署目标更改为10.0,并在watchOS 3.0模拟器和iPhone 6s iOS 10模拟器上运行,请更新以下设置: 将“否”更改为“是”:
Project > Targets > App Name > Embed Asset Packs In Product Bundle = YES
“Hello,World!”应该出现在Apple Watch上,带有一个旋转、脉冲的Spritode(没有显示在屏幕截图中,因为捕捉不够快)
请注意,您可能需要从iPhone模拟器的Apple Watch应用程序中安装应用程序,方法是启动Apple Watch应用程序,单击您的应用程序,然后按“在Apple Watch上显示”。我的iMessage扩展应用程序中出现dyld图像错误,但“将资产包嵌入产品包”尚未修复。建议?