【问题标题】:nativescript Starting iOS Simulator Cannot read property 'state' of undefinednativescript 启动 iOS 模拟器无法读取未定义的属性“状态”
【发布时间】:2016-05-28 16:13:15
【问题描述】:

我正在尝试遵循 OS X 上的 nativescript 设置: http://docs.nativescript.org/angular/tutorial/ng-chapter

tns doctor 告诉我:No issues were detected.

但是当我在构建后运行tns run ios --emulator 时,我得到了错误:

Starting iOS Simulator
Cannot read property 'state' of undefined

我的设置缺少什么?

【问题讨论】:

  • 你添加平台了吗?

标签: nativescript


【解决方案1】:

除了同事提供的解决方案外,当您有多个连接的设备/模拟器并想在一个特定设备上进行测试时,我还可以提出以下建议:

  • 检查您当前启动的设备/模拟器/模拟器

tns 设备 将返回类似

│ # │ Device Name │ Platform │ Device Identifier   │ Type     │ Status    │
│ 1 │ vbox86p     │ Android  │ 192.168.56.101:5555 | Emulator │ Connected │
│ 2 │ iPhone 5    │ iOS      │ f5ae7a02a8ba77fa572 │ Device   │ Connected │
│ 3 │ iPhone 6    │ iOS      │ 03AEBB35-4EC4-4DCC  │ Emulator │ Connected |
  • 选择所需的设备(复制其 ID 或设备标识符)并运行以下命令:

tns run ios --设备ID

tns 运行 ios --device deviceIdentifier

例如:

tns run android --device 1                // will run on Android device
tns run ios --device 3                    // will run on the iOS emulator
tns run ios --device f5ae7a02a8ba77fa572  // will run on the iOS device

【讨论】:

    【解决方案2】:

    我遇到了同样的问题,所以我在xcode中打开它,发现我没有安装任何模拟器。

    尝试其中一个或两个,看看你是否可以在 xcode 中构建它: open platforms/ios/*.xcworkspace/ open platforms/ios/*.xcodeproj/

    ...如果您的问题与我的相同,请在 xcode 中像这样修复它...

    Xcode 菜单 -> 首选项 -> 下载选项卡 -> 然后下载最新的 iOS 模拟器

    对我来说,它通过下载 ios 9.1 来工作。

    【讨论】:

      【解决方案3】:

      可能是 SDK 的问题。您可以在此处找到此问题的可能解决方案:iOS Simulator could not find the SDK 另一种选择可能是再次安装 NativeScript CLI 并仔细设置 JAVA_HOMEANDROID_HOMECocoaPods,如文档中所述:Set Up the NativeScript CLI on OS X

      【讨论】:

        猜你喜欢
        • 2021-07-14
        • 2019-06-08
        • 2021-05-31
        • 1970-01-01
        • 2021-11-28
        • 2019-07-25
        • 2020-11-05
        • 2021-07-07
        相关资源
        最近更新 更多