Rob Rob - 3 months ago 88
iOS Question

NativeScript app won't run on IOS

I am evaluating nativescript, but I cannot get it to work on IOS. It all works well when running on an Android device/emulator though (from a mac).

I set everything up according to the tutorial on the nativescript site, and tried again with a fresh checkout of angular2-seed-advanced.


  • When running on an IOS-Simulator the apps start, but do not get past the splash screen (groceries shows its own logo, seed the nativescript logo).

    Successfully deployed on device with identifier 'yyyyyyyyyyyyyyyyyyyyy'.
    Aug 30 00:13:35 macmini com.apple.CoreSimulator.SimDevice.yyyyyyyyyyyyyyyyyyyyy.launchd_sim[59384] (UIKitApplication:org.nativescript.groceries[0x9af7][60400]): Service exited due to signal: Killed: 9

  • When trying to run on an IOS-Device (IPhone 5), I get another error during the attempt to deploy (same for both projects), so the app does not even get deployed to the device. Seems to a dependency of nativescript (FiberFuture?) not getting a promise resolved when waiting for a physical device to call back (the Simulator seems to get past this step).

    TypeError: Cannot read property 'id' of undefined
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:566:15)
    at /usr/local/lib/node_modules/nativescript/lib/common/errors.js:128:33


    See this full --log trace

    macmini:nativescript xxx$ tns run ios --log trace
    execFile: /usr/local/opt/android-sdk/platform-tools/adb "help"
    execFile: /usr/local/opt/android-sdk/platform-tools/adb "help"
    spawn: /usr/local/opt/android-sdk/platform-tools/adb "--help"
    Socket {
    connecting: false,
    _hadError: false,
    _handle:
    Pipe {
    bytesRead: 0,
    _externalStream: {},
    fd: 15,
    writeQueueSize: 0,
    owner: [Circular],
    onread: [Function: onread],
    reading: true },
    _parent: null,
    _host: null,
    _readableState:
    ReadableState {
    objectMode: false,
    highWaterMark: 16384,
    buffer: BufferList { head: null, tail: null, length: 0 },
    length: 0,
    pipes: null,
    pipesCount: 0,
    flowing: null,
    ended: false,
    endEmitted: false,
    reading: true,
    sync: false,
    needReadable: true,
    emittedReadable: false,
    readableListening: false,
    resumeScheduled: false,
    defaultEncoding: 'utf8',
    ranOut: false,
    awaitDrain: 0,
    readingMore: false,
    decoder: null,
    encoding: null },
    readable: true,
    domain: null,
    _events:
    { end: { [Function: g] listener: [Function: onend] },
    finish: [Function: onSocketFinish],
    _socketEnd: [Function: onSocketEnd],
    close: [Function] },
    _eventsCount: 4,
    _maxListeners: undefined,
    _writableState:
    WritableState {
    objectMode: false,
    highWaterMark: 16384,
    needDrain: false,
    ending: false,
    ended: false,
    finished: false,
    decodeStrings: false,
    defaultEncoding: 'utf8',
    length: 0,
    writing: false,
    corked: 0,
    sync: true,
    bufferProcessing: false,
    onwrite: [Function],
    writecb: null,
    writelen: 0,
    bufferedRequest: null,
    lastBufferedRequest: null,
    pendingcb: 0,
    prefinished: false,
    errorEmitted: false,
    bufferedRequestCount: 0,
    corkedRequestsFree: CorkedRequest { next: null, entry: null, finish: [Function] } },
    writable: false,
    allowHalfOpen: false,
    destroyed: false,
    _bytesDispatched: 0,
    _sockname: null,
    _writev: null,
    _pendingData: null,
    _pendingEncoding: '',
    server: null,
    _server: null }
    Exec uname -a
    stdout: Darwin macmini 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64

    stderr:
    Exec npm -v
    stdout: 3.10.3

    stderr:
    spawn: java "-version"
    Exec node-gyp -v
    stdout: v3.4.0

    stderr:
    Exec xcodebuild -version
    stdout: Xcode 7.3.1
    Build version 7D1014

    stderr:
    Exec gem which xcodeproj
    stdout: /Users/rob/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj.rb

    stderr:
    Exec pod --version
    stdout: 1.0.1

    stderr:
    Exec '/usr/local/opt/android-sdk/platform-tools/adb' version
    stdout: Android Debug Bridge version 1.0.36
    Revision af05c7354fe1-android

    stderr:
    spawn: /usr/local/opt/android-sdk/tools/android "-h"
    Result when throw error is false:
    { stdout: '\n Usage:\n android [global options] action [action options]\n Global options:\n -s --silent : Silent mode, shows errors only.\n -v --verbose : Verbose mode, shows errors, warnings and all messages.\n --clear-cache: Clear the SDK Manager repository manifest cache.\n -h --help : Help on a specific command.\n\n Valid\n actions\n are\n composed\n of a verb\n and an\n optional\n direct\n object:\n- sdk : Displays the SDK Manager window.\n- avd : Displays the AVD Manager window.\n- list : Lists existing targets or virtual devices.\n- list avd : Lists existing Android Virtual Devices.\n- list target : Lists existing targets.\n- list device : Lists existing devices.\n- list sdk : Lists remote SDK repository.\n- create avd : Creates a new Android Virtual Device.\n- move avd : Moves or renames an Android Virtual Device.\n- delete avd : Deletes an Android Virtual Device.\n- update avd : Updates an Android Virtual Device to match the folders\n of a new SDK.\n- create project : Creates a new Android project.\n- update project : Updates an Android project (must already have an\n AndroidManifest.xml).\n- create test-project : Creates a new Android project for a test package.\n- update test-project : Updates the Android project for a test package (must\n already have an AndroidManifest.xml).\n- create lib-project : Creates a new Android library project.\n- update lib-project : Updates an Android library project (must already have\n an AndroidManifest.xml).\n- create uitest-project: Creates a new UI test project.\n- update adb : Updates adb to support the USB devices declared in the\n SDK add-ons.\n- update sdk : Updates the SDK by suggesting new platforms to install\n if available.\n',
    stderr: '',
    exitCode: 1 }
    Exec mono --version
    stdout: Mono JIT compiler version 4.4.1 (Nightly 4.4.1.0/4747417 Tue Jul 5 17:44:19 BST 2016)
    Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS: normal
    SIGSEGV: altstack
    Notification: kqueue
    Architecture: amd64
    Disabled: none
    Misc: softdebug
    LLVM: supported, not enabled.
    GC: sgen

    stderr:
    Exec git --version
    stdout: git version 2.7.4 (Apple Git-66)

    stderr:
    Exec gradle -v
    stdout:
    stderr: /bin/sh: gradle: command not found

    Exec "javac" -version
    stdout:
    stderr: javac 1.8.0_102

    System information:
    { procInfo: 'nativescript/2.2.1',
    platform: 'darwin',
    os: 'Darwin macmini 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64\n',
    shell: '/bin/bash',
    dotNetVer: null,
    procArch: 'x64',
    nodeVer: 'v6.3.1',
    npmVer: '3.10.3',
    javaVer: '1.8.0',
    nodeGypVer: 'v3.4.0\n',
    xcodeVer: 'Xcode 7.3.1\nBuild version 7D1014\n',
    xcodeprojGemLocation: '/Users/rob/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj.rb\n',
    itunesInstalled: true,
    cocoapodVer: '1.0.1',
    adbVer: 'Android Debug Bridge version 1.0.36',
    androidInstalled: true,
    monoVer: '4.4.1',
    gitVer: '2.7.4 (Apple Git-66)',
    gradleVer: null,
    javacVersion: '1.8.0_102' }
    Initializing analytics statuses.
    Analytics statuses:
    { TrackFeatureUsage: 1, TrackExceptions: 1 }
    Trying to track feature 'CLI' with value 'run'.
    Looking for project in '/Users/xxx/workspace/angular2-seed-advanced/nativescript'
    Project directory is '/Users/xxx/workspace/angular2-seed-advanced/nativescript'.
    Analytics statuses:
    { TrackFeatureUsage: 1, TrackExceptions: 1 }
    Trying to track feature 'CLI' with value 'run|ios'.
    startLookingForDevices; platform is iOS
    Found device with identifier 'c28457499xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
    Exec ps cax | grep launchd_sim
    stdout: 51449 ?? S 0:01.63 launchd_sim

    stderr:
    TypeError: Cannot read property 'id' of undefined
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:566:15)
    at /usr/local/lib/node_modules/nativescript/lib/common/errors.js:128:33
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/common/services/commands-service.js:84:106
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/common/yok.js:208:124
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/common/services/commands-service.js:51:55
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/common/errors.js:128:33
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    - - - - -
    at IOSSimulator.Object.defineProperty.get [as deviceInfo] (/usr/local/lib/node_modules/nativescript/lib/common/mobile/ios/simulator/ios-simulator-device.js:15:43)
    at IOSSimulatorDiscovery.DeviceDiscovery.addDevice (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/device-discovery.js:16:28)
    at IOSSimulatorDiscovery.createAndAddDevice (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/ios-simulator-discovery.js:58:14)
    at IOSSimulatorDiscovery.checkForDevices (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/ios-simulator-discovery.js:27:26)
    at IOSSimulatorDiscovery.startLookingForDevices (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/ios-simulator-discovery.js:20:21)
    at /usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/devices-service.js:215:50
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/devices-service.js:330:48
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/services/platform-service.js:366:103
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/services/platform-service.js:402:58
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    Analytics statuses:
    { TrackFeatureUsage: 1, TrackExceptions: 1 }
    Trying to track feature 'CLI' with value 'help'.
    List of registered commands: /?, appstore, appstore|upload, autocomplete, autocomplete|disable, autocomplete|enable, autocomplete|status, build, build|android, build|ios, create, debug, debug|android, debug|ios, deploy, dev-generate-help, dev-generate-messages, dev-post-install, dev-preuninstall, dev-test, dev-test|android, dev-test|ios, device, device|android, device|get-file, device|ios, device|list-applications, device|list-files, device|log, device|put-file, device|run, device|stop, device|uninstall, doctor, emulate, emulate|android, emulate|ios, error-reporting, help, info, init, install, livesync, platform, platform|add, platform|clean, platform|remove, platform|update, plugin, plugin|add, plugin|find, plugin|install, plugin|remove, plugin|search, plugin|update, prepare, publish, publish|ios, run, run|android, run|ios, test, test|android, test|init, test|ios, usage-reporting
    Reading help for command 'run|ios'. FileName is 'run-ios.md'.



Any help with this would be greatly appreciated!

Thanks,
Rob

Rob Rob
Answer

Thanks to @Kansen and @tj-vantoll!

I got it solved with both solutions. First installing node via NVM (6.5.0), because as non-root user I had to use sudo to install nativescript globally, during the installation there are some permission errors like "root has no permission to write in /Users/myUser"

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.6/install.sh | bash

nvm install node
nvm use node
# re-open terminal or re-source your bash config e.g.:
source ~/.bashrc

Then do a fresh global install of nativescript (now in new nvm node instance, so cache clean and remove can be omitted, plus no sudo needed because this instance is installed in ~/.nvm/...)

npm i -g nativescript