0
votes

I'm trying to follow the nativescript setup on OS X: http://docs.nativescript.org/angular/tutorial/ng-chapter

tns doctor tells me: No issues were detected.

But when I run tns run ios --emulator after the build I get the error:

Starting iOS Simulator
Cannot read property 'state' of undefined

What is my setup missing?

3
Did you add the platform ? - Deepak

3 Answers

1
votes

In addition to the solutions provided by te collegues I can also suggest the following when you have multiple connected devices/emulators and want to test on one specific:

  • Check your currently started devices/simulators/emulators with

tns device will return something like

│ # │ 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 |
  • Select your desired device (copy its ID or Device Identifier) and run the following:

tns run ios --device ID

or

tns run ios --device deviceIdentifier

for example:

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
0
votes

I had the same problem, so I opened it up in xcode and realised that I didn't have any simulators installed.

try either or both of these to see if you can build it in xcode: open platforms/ios/*.xcworkspace/ open platforms/ios/*.xcodeproj/

... and if your problem is the same as mine, fix it in xcode like this...

Xcode menu -> preferences -> Downloads tab -> then download the newest iOS simulator

For me it worked by downloading ios 9.1.

0
votes

it might be problem with the SDK. Possible solution for this problem you could find here: iOS Simulator could not find the SDK Another option could be to install NativeScript CLI again and to set up carefully JAVA_HOME, ANDROID_HOME and CocoaPods as it is described in the documentation: Set Up the NativeScript CLI on OS X