2016-06-14 13 views
4

我下載了xCode 8.0 beta並打開了一個最近寫入swift 2的項目,然後我使用xCode將其轉換爲swift 3在Apple Watch Simulator(xCode 8,Swift 3,iOS 10)上的watchOS中運行SpriteKit遊戲 - libswiftSwiftOnoneSupport錯誤

我再補充一個watchOS目標我的設置「遊戲」

文件>新建>目標項目:

screenshot

我查了GameScene.swift在WatchExtension果然所有的代碼在那裏,並設置一個場景:

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
  • 創建一個新的模擬器配對Apple Watch使用Add Additional Simulators,
  • 新增Skip安裝=否,建議here,
  • 從配對蘋果iOS應用程序觀看在iPhone模擬器(只是不安裝)安裝,
  • 即使添加用戶定義的項目設置,如在raywenderlich watchOS教程建議...

我做不到讓它甚至可以安裝或出現在Apple Watch上。我沒做什麼?

UPDATE

我已經調整了部署目標至10.0 iOS應用程式,我終於能夠從iPhone模擬器的Apple關注的應用程序,安裝它除了在從啓動Apple關注應用蘋果手錶模擬器,我得到以下錯誤:

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測試...

回答

3

可能不是真正的解決方案,但一個工作,我發現在嘗試各種事情後小時發現here, on Stackoverflow,爲錯誤發生在上面我的問題的底部。

因此,如果您將應用程序轉換爲Swift 3.0,請將watchOS「遊戲」目標添加到您的項目中,將iOS Deployment Target更改爲10.0並在WatchOS 3.0 Simulator和iPhone 6s iOS 10 Simulator上運行,更新以下設置:

NO改爲YES:

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

和「你好,世界!「應該出現在Apple關注,具有紡紗,脈衝spriteNode(截圖中沒有顯示爲沒有捕捉到它足夠快)。

Apple Watch

請注意,您可能需要從安裝App通過啓動Apple Watch應用程序,點擊您的應用程序,然後按下「在Apple Watch上顯示」,Apple Watch應用程序將從iPhone Simulator中啓動。

+0

我在我的iMessage擴展應用程序中收到了dyld圖像錯誤,但「捆綁「沒有解決它。建議? –

相關問題