WatchOS未在Xcode 7中的运行目标中列出

时间:2015-09-25 16:15:07

标签: ios-simulator ios9 xcode7 watch-os-2

我按照本教程(http://code.tutsplus.com/tutorials/create-a-native-apple-watch-app-for-watchos-2--cms-24201)创建了一个demo watchOS 2应用程序。我无法让它在模拟器中运行,因为watchOS模拟器未在运行目标中列出。

enter image description here

在本教程中,运行目的地显示为否则:

enter image description here

我已经厌倦了可以在互联网上找到的任何可能的解决方案。

我错过了什么?或者,这是Xcode的问题吗?

我在OS X 10.10.5上运行Xcode 7(7A220)。

感谢。

更新

检查日志,看起来CoreSimulator无法与设备建立连接。

这里是system.log:

Sep 26 00:37:04 Chertan kernel[0]: memorystatus_thread: idle exiting pid 4789 [com.apple.CoreSi]
Sep 26 00:37:04 Chertan.local com.apple.CoreSimulator.CoreSimulatorService[4817]: com.apple.CoreSimulator.CoreSimulatorService 179~1 starting.
Sep 26 00:37:05 Chertan.local com.apple.CoreSimulator.CoreSimulatorService[4817]: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/26A5557E-A18E-463D-A983-2D97A2C5826A/device.plist
Sep 26 00:37:05 Chertan.local com.apple.CoreSimulator.CoreSimulatorService[4817]: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/36049C9F-D5B2-454D-80C7-14BC8C0BBC5F/device.plist
Sep 26 00:37:05 Chertan.local com.apple.CoreSimulator.CoreSimulatorService[4817]: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/42A77066-16B7-4393-A705-293ACAA30912/device.plist
Sep 26 00:37:05 Chertan.local com.apple.CoreSimulator.CoreSimulatorService[4817]: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/50BAB20D-DF79-4728-800C-6A989333A600/device.plist
Sep 26 00:37:05 Chertan.local com.apple.CoreSimulator.CoreSimulatorService[4817]: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/680A57B1-A08C-43C6-878F-0C9DD05584C0/device.plist
Sep 26 00:37:05 Chertan.local com.apple.CoreSimulator.CoreSimulatorService[4817]: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/7CB45BED-2A19-48E3-9EC7-827FFFB8B5E1/device.plist
Sep 26 00:37:05 Chertan.local com.apple.CoreSimulator.CoreSimulatorService[4817]: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/ABDD6B28-7831-4576-B704-A1FE57F4559C/device.plist
Sep 26 00:37:05 Chertan.local com.apple.CoreSimulator.CoreSimulatorService[4817]: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/BEC6C8F1-DB9F-4348-A0ED-01642077570D/device.plist
Sep 26 00:37:05 Chertan.local com.apple.CoreSimulator.CoreSimulatorService[4817]: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/C2725678-5BC4-4D1B-9630-37162685DBA8/device.plist
Sep 26 00:37:05 Chertan.local com.apple.CoreSimulator.CoreSimulatorService[4817]: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/C85E5433-0176-4091-B27E-9FEA89C6439C/device.plist
Sep 26 00:37:05 Chertan.local com.apple.CoreSimulator.CoreSimulatorService[4817]: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/ED850CEF-AD0E-4808-8425-8597DB197249/device.plist
Sep 26 00:37:05 Chertan.local com.apple.CoreSimulator.CoreSimulatorService[4817]: CoreSimulatorService connection interrupted.  Resubscribing to notifications.
Sep 26 00:37:05 --- last message repeated 5 times ---
Sep 26 00:37:05 Chertan.local com.apple.CoreSimulator.CoreSimulatorService[4817]: Notification is missing xpc_notification key: {
        notification = "availableDevices_changed";
    }

和CoreSimulator.log:

Sep 26 00:37:04 Chertan.local CoreSimulatorService[4817] <Notice>: com.apple.CoreSimulator.CoreSimulatorService 179~1 starting.
Sep 26 00:37:05 Chertan.local CoreSimulatorService[4817] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/26A5557E-A18E-463D-A983-2D97A2C5826A/device.plist
Sep 26 00:37:05 Chertan.local CoreSimulatorService[4817] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/36049C9F-D5B2-454D-80C7-14BC8C0BBC5F/device.plist
Sep 26 00:37:05 Chertan.local CoreSimulatorService[4817] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/42A77066-16B7-4393-A705-293ACAA30912/device.plist
Sep 26 00:37:05 Chertan.local CoreSimulatorService[4817] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/50BAB20D-DF79-4728-800C-6A989333A600/device.plist
Sep 26 00:37:05 Chertan.local CoreSimulatorService[4817] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/680A57B1-A08C-43C6-878F-0C9DD05584C0/device.plist
Sep 26 00:37:05 Chertan.local CoreSimulatorService[4817] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/7CB45BED-2A19-48E3-9EC7-827FFFB8B5E1/device.plist
Sep 26 00:37:05 Chertan.local CoreSimulatorService[4817] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/ABDD6B28-7831-4576-B704-A1FE57F4559C/device.plist
Sep 26 00:37:05 Chertan.local CoreSimulatorService[4817] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/BEC6C8F1-DB9F-4348-A0ED-01642077570D/device.plist
Sep 26 00:37:05 Chertan.local CoreSimulatorService[4817] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/C2725678-5BC4-4D1B-9630-37162685DBA8/device.plist
Sep 26 00:37:05 Chertan.local CoreSimulatorService[4817] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/C85E5433-0176-4091-B27E-9FEA89C6439C/device.plist
Sep 26 00:37:05 Chertan.local CoreSimulatorService[4817] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/ED850CEF-AD0E-4808-8425-8597DB197249/device.plist
Sep 26 00:37:05 Chertan.local com.apple.dt.Xcode[3447] <Warning>: CoreSimulatorService connection interrupted.  Resubscribing to notifications.
Sep 26 00:37:05 Chertan.local com.apple.ibtool[4661] <Warning>: CoreSimulatorService connection interrupted.  Resubscribing to notifications.
Sep 26 00:37:05 Chertan.local com.apple.ibtool[4656] <Warning>: CoreSimulatorService connection interrupted.  Resubscribing to notifications.
Sep 26 00:37:05 Chertan.local com.apple.ibtool[4661] <Warning>: CoreSimulatorService connection interrupted.  Resubscribing to notifications.
Sep 26 00:37:05 Chertan.local com.apple.ibtool[4656] <Warning>: CoreSimulatorService connection interrupted.  Resubscribing to notifications.
Sep 26 00:37:05 Chertan.local com.apple.iphonesimulator[4688] <Warning>: CoreSimulatorService connection interrupted.  Resubscribing to notifications.
Sep 26 00:37:05 Chertan.local CoreSimulatorService[4817] <Warning>: Notification is missing xpc_notification key: {
        notification = "availableDevices_changed";
    }
Sep 26 00:37:32 Chertan.local CoreSimulatorService[4831] <Notice>: com.apple.CoreSimulator.CoreSimulatorService 179~1 starting.
Sep 26 00:37:32 Chertan.local CoreSimulatorService[4831] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/26A5557E-A18E-463D-A983-2D97A2C5826A/device.plist
Sep 26 00:37:32 Chertan.local CoreSimulatorService[4831] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/36049C9F-D5B2-454D-80C7-14BC8C0BBC5F/device.plist
Sep 26 00:37:32 Chertan.local CoreSimulatorService[4831] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/42A77066-16B7-4393-A705-293ACAA30912/device.plist
Sep 26 00:37:32 Chertan.local CoreSimulatorService[4831] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/50BAB20D-DF79-4728-800C-6A989333A600/device.plist
Sep 26 00:37:32 Chertan.local CoreSimulatorService[4831] <Notice>: SimDevice : iPhone 6 (52D0F6E4-1431-4181-9CA8-C28F2BDFB640) : state={ Booted } deviceType={ SimDeviceType : com.apple.CoreSimulator.SimDeviceType.iPhone-6 } runtime={ SimRuntime : 9.0 (13A340) - com.apple.CoreSimulator.SimRuntime.iOS-9-0 } found in an inconsistent state: Loaded: 0 Running: 0 ... shutting down
Sep 26 00:37:32 Chertan.local CoreSimulatorService[4831] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/680A57B1-A08C-43C6-878F-0C9DD05584C0/device.plist
Sep 26 00:37:32 Chertan.local CoreSimulatorService[4831] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/7CB45BED-2A19-48E3-9EC7-827FFFB8B5E1/device.plist
Sep 26 00:37:32 Chertan.local CoreSimulatorService[4831] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/ABDD6B28-7831-4576-B704-A1FE57F4559C/device.plist
Sep 26 00:37:32 Chertan.local CoreSimulatorService[4831] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/BEC6C8F1-DB9F-4348-A0ED-01642077570D/device.plist
Sep 26 00:37:32 Chertan.local CoreSimulatorService[4831] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/C2725678-5BC4-4D1B-9630-37162685DBA8/device.plist
Sep 26 00:37:32 Chertan.local CoreSimulatorService[4831] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/C85E5433-0176-4091-B27E-9FEA89C6439C/device.plist
Sep 26 00:37:32 Chertan.local CoreSimulatorService[4831] <Error>: Unable to load device.plist: /Users/adrian/Library/Developer/CoreSimulator/Devices/ED850CEF-AD0E-4808-8425-8597DB197249/device.plist
Sep 26 00:37:32 Chertan.local com.apple.ibtool[4656] <Warning>: CoreSimulatorService connection interrupted.  Resubscribing to notifications.
Sep 26 00:37:32 Chertan.local com.apple.dt.Xcode[3447] <Warning>: CoreSimulatorService connection interrupted.  Resubscribing to notifications.
Sep 26 00:37:32 Chertan.local com.apple.ibtool[4656] <Warning>: CoreSimulatorService connection interrupted.  Resubscribing to notifications.
Sep 26 00:37:32 Chertan.local com.apple.ibtool[4661] <Warning>: CoreSimulatorService connection interrupted.  Resubscribing to notifications.
Sep 26 00:37:32 Chertan.local com.apple.ibtool[4661] <Warning>: CoreSimulatorService connection interrupted.  Resubscribing to notifications.

2 个答案:

答案 0 :(得分:1)

这通常表明Xcode.app无法与CoreSimulatorService进行通信。 Xcode 6.x中存在很多问题。在7.0中进行了改进,但仍有一些情况可能会遇到问题。

如果您遇到这样的问题,最简单的方法就是使用大锤并重新启动。

  1. 不要重命名Xcode.app,因为这是进入此状态的主要原因。
  2. 如果您重命名Xcode.app,请重新启动以进入干净状态。
  3. 如果重启后仍有问题,可能会提示〜/ Library / Logs / CoreSimulator / CoreSimulator.log和/var/log/system.log中出现了什么问题。

答案 1 :(得分:0)

我使用终端命令xcrun simctl解决了这个问题。这是输出:

$ xcrun simctl list

== Device Types ==
iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)
iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)
iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)
iPhone 6 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus)
iPhone 6s (com.apple.CoreSimulator.SimDeviceType.iPhone-6s)
iPhone 6s Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6s-Plus)
iPad 2 (com.apple.CoreSimulator.SimDeviceType.iPad-2)
iPad Retina (com.apple.CoreSimulator.SimDeviceType.iPad-Retina)
iPad Air (com.apple.CoreSimulator.SimDeviceType.iPad-Air)
iPad Air 2 (com.apple.CoreSimulator.SimDeviceType.iPad-Air-2)
Apple Watch - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-38mm)
Apple Watch - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-42mm)
== Runtimes ==
iOS 9.0 (9.0 - 13A340) (com.apple.CoreSimulator.SimRuntime.iOS-9-0)
watchOS 2.0 (2.0 - 13S343) (com.apple.CoreSimulator.SimRuntime.watchOS-2-0)
== Devices ==
-- iOS 9.0 --
    iPhone 6 (21272670-640D-436E-8DD4-F4014D2F63DC) (Booted)
-- watchOS 2.0 --
== Device Pairs ==

由于某些我不知道的原因,Xcode 7和Simulator无法正确识别和设置watchOS 2.0设备。

$ xcrun simctl create "Apple Watch 38mm" com.apple.CoreSimulator.SimDeviceType.Apple-Watch-38mm com.apple.CoreSimulator.SimRuntime.watchOS-2-0

输出:

EF648CAD-2C4B-4BD5-9C36-9D1DB3E3CD29

然后,

$ xcrun simctl boot EF648CAD-2C4B-4BD5-9C36-9D1DB3E3CD29

$ xcrun simctl pair EF648CAD-2C4B-4BD5-9C36-9D1DB3E3CD29 21272670-640D-436E-8DD4-F4014D2F63DC

这创建了一个新的配对设备ID:

AA86202A-A141-40AD-B3A6-61F755C39534

$ xcrun simctl list
== Device Types ==
iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)
iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)
iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)
iPhone 6 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus)
iPhone 6s (com.apple.CoreSimulator.SimDeviceType.iPhone-6s)
iPhone 6s Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6s-Plus)
iPad 2 (com.apple.CoreSimulator.SimDeviceType.iPad-2)
iPad Retina (com.apple.CoreSimulator.SimDeviceType.iPad-Retina)
iPad Air (com.apple.CoreSimulator.SimDeviceType.iPad-Air)
iPad Air 2 (com.apple.CoreSimulator.SimDeviceType.iPad-Air-2)
Apple Watch - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-38mm)
Apple Watch - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-42mm)
== Runtimes ==
iOS 9.0 (9.0 - 13A340) (com.apple.CoreSimulator.SimRuntime.iOS-9-0)
watchOS 2.0 (2.0 - 13S343) (com.apple.CoreSimulator.SimRuntime.watchOS-2-0)
== Devices ==
-- iOS 9.0 --
    iPhone 6 (21272670-640D-436E-8DD4-F4014D2F63DC) (Booted)
-- watchOS 2.0 --
    Apple Watch 38mm (EF648CAD-2C4B-4BD5-9C36-9D1DB3E3CD29) (Booted)
== Device Pairs ==
AA86202A-A141-40AD-B3A6-61F755C39534 (connected)
    Watch: Apple Watch 38mm (EF648CAD-2C4B-4BD5-9C36-9D1DB3E3CD29) (Booted)
    Phone: iPhone 6 (21272670-640D-436E-8DD4-F4014D2F63DC) (Booted)

现在,我已创建了一个设备对并已连接。回到Xcode,我在运行目的地列出了配对设备:

enter image description here