【问题标题】:Could not build Objective-C module CoreMotion error for tvOS target无法为 tvOS 目标构建 Objective-C 模块 CoreMotion 错误
【发布时间】:2015-12-18 04:14:08
【问题描述】:

从我的 Sprite Kit iOS 游戏创建我的 tvOS 目标时,我遇到了几个错误。

第一个是:Could not build Objective-C module CoreMotion

第二个:找不到伞头“CoreMotion.h”

为了移植游戏,我从 iOS 目标中选择了我的大部分文件和资产,并检查了 TVOS 目标。

如果我注释掉所有 CoreMotion 代码,错误就会消失。我搜索了谷歌并在这里找到答案,但没有找到任何实质性的东西。

有人知道怎么解决吗?

【问题讨论】:

    标签: ios sprite-kit tvos core-motion


    【解决方案1】:

    问题是 tvOS 不支持 CoreMotion。

    我必须使用 iOS 特定代码才能使其适用于所有相关代码。

    像这样:

    #if os(iOS)
       import CoreMotion
    #endif
    

    您还可以制作 tvOS 特定代码:

    #if os(iOS)
      let gameGain: CGFloat = 2.5
    #elseif os(tvOS) // tvOS
      let gameGain: CGFloat = 2.0
    #endif
    

    【讨论】:

      猜你喜欢
      • 2017-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-29
      • 2015-07-05
      • 2016-10-16
      • 2016-04-06
      • 2018-05-25
      相关资源
      最近更新 更多