【发布时间】:2016-06-14 19:42:13
【问题描述】:
我下载了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 模拟器上安装它。
我已经尝试了所有我能想到的方法,包括:
- 清理构建等
- 卸载/重新安装,
- 检查了 info.plist for common errors,
- 使用
Add Additional Simulators与配对的 Apple Watch 创建了一个新模拟器, - 添加了跳过安装 = 否,建议 here,
- 在 iPhone 模拟器中从配对的 iOS Apple Watch 应用安装(只是不安装),
- 甚至添加了用户定义的项目设置,如 raywenderlich watchOS 教程中所建议的...
我什至无法让它安装或出现在 Apple Watch 上。我没有做什么?
更新
我已将 iOS 应用程序的部署目标调整为 10.0,我终于能够从 iPhone 模拟器中的 Apple Watch 应用程序安装它,除了从 Apple Watch 模拟器启动 Apple Watch 应用程序时,我得到以下信息错误:
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 测试...
【问题讨论】:
标签: xcode swift sprite-kit apple-watch watchos