Skip to content

iOS: Xcode 8.3 archiving and running app from Xcode to real device fails #2700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dxshindeo opened this issue Apr 7, 2017 · 2 comments
Closed
Assignees
Labels

Comments

@dxshindeo
Copy link

dxshindeo commented Apr 7, 2017

First, why is tns run ios --device xxxx command now archiving my project?
** ARCHIVE SUCCEEDED **
It takes twice as long for the command to pop the app on my device!

Second, after calling tns run ios --device xxxx OR tns build ios --release AND then opening .xcworkspace file AND then trying to run the app on the real device (it does work when emulator is selected) from Xcode, I get the following in Xcode console:

2017-04-07 12:45:21.049890+0300 TEST[2549:423103] [DYMTLInitPlatform] platform initialization successful
***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
2017-04-07 12:45:21.868741+0300 TEST[2549:423001] 1   0x1042adb -[TNSRuntime executeModule:referredBy:]
1   0x1042adb -[TNSRuntime executeModule:referredBy:]
2017-04-07 12:45:21.877689+0300 TEST[2549:423001] 2   0x9dc0b main
2   0x9dc0b main
2017-04-07 12:45:21.877892+0300 TEST[2549:423001] 3   0x1d46a4eb <redacted>
3   0x1d46a4eb <redacted>
JavaScript stack trace:
1   @file:///app/main.js:3:25
JavaScript error:
2017-04-07 12:45:21.878666+0300 TEST[2549:423001] file:///app/main.js:3:25: JS ERROR Error: Could not find module 'nativescript-angular/platform'. Computed path '/var/mobile/Containers/Data/Application/891BD688-73A2-46B6-9A5C-541A46EE86D2/Library/Application Support/LiveSync/app/tns_modules/nativescript-angular/platform'.

file:///app/main.js:3:25: JS ERROR Error: Could not find module 'nativescript-angular/platform'. Computed path '/var/mobile/Containers/Data/Application/891BD688-73A2-46B6-9A5C-541A46EE86D2/Library/Application Support/LiveSync/app/tns_modules/nativescript-angular/platform'.
(lldb) 

NS CLI: 2.5.4
Xcode: 8.3
Device: iPhone 5

package.json:

{
  "description": "Test Mobile Application",
  "license": "",
  "readme": "",
  "repository": "",
  "nativescript": {
    "id": "org.test.app",
    "tns-ios": {
      "version": "2.5.0"
    }
  },
  "dependencies": {
    "@angular/common": "4.0.1",
    "@angular/compiler": "4.0.1",
    "@angular/core": "4.0.1",
    "@angular/forms": "4.0.1",
    "@angular/http": "4.0.1",
    "@angular/platform-browser": "4.0.1",
    "@angular/platform-browser-dynamic": "4.0.1",
    "@angular/router": "4.0.1",
    "PhoenixClient": "file:resources/PhoenixClient",
    "base-64": "^0.1.0",
    "nativescript-angular": "1.5.1",
    "nativescript-angular-snapshot": "1.5.1-5.5.372.32",
    "nativescript-camera": "0.0.8",
    "nativescript-fresco": "^1.0.16",
    "nativescript-geolocation": "0.0.19",
    "nativescript-gif": "1.0.9",
    "nativescript-google-maps-sdk": "1.4.3",
    "nativescript-imagepicker": "^2.5.1",
    "nativescript-phone": "1.3.0",
    "nativescript-vibrate": "1.1.2",
    "nativescript-webview-interface": "^1.4.1",
    "reflect-metadata": "0.1.10",
    "rxjs": "5.3.0",
    "tns-core-modules": "2.5.2",
    "tns-platform-declarations": "2.5.2",
    "zone.js": "0.8.5"
  },
  "devDependencies": {
    "@angular/compiler-cli": "4.0.1",
    "@ngtools/webpack": "1.2.13",
    "babel-traverse": "6.23.1",
    "babel-types": "6.23.0",
    "babylon": "6.16.1",
    "copy-webpack-plugin": "4.0.1",
    "extract-text-webpack-plugin": "2.1.0",
    "htmlparser2": "3.9.2",
    "lazy": "1.0.11",
    "nativescript-css-loader": "0.26.1",
    "nativescript-dev-android-snapshot": "0.*.*",
    "nativescript-dev-typescript": "0.4.2",
    "nativescript-dev-webpack": "0.3.7",
    "raw-loader": "0.5.1",
    "resolve-url-loader": "2.0.2",
    "typescript": "2.1.6",
    "webpack": "2.3.3",
    "webpack-sources": "0.2.3"
  },
  "scripts": {
    "ns-bundle": "ns-bundle",
    "start-android-bundle": "npm run ns-bundle --android --start-app",
    "start-ios-bundle": "npm run ns-bundle --ios --start-app",
    "build-android-bundle": "npm run ns-bundle --android --build-app",
    "build-ios-bundle": "npm run ns-bundle --ios --build-app"
  }
}

@yyosifov yyosifov self-assigned this Apr 10, 2017
@yyosifov
Copy link
Contributor

yyosifov commented Apr 10, 2017

Hi @dxshindeo,

Sorry for your troubles.

  1. The archive/export part was added due to changes in Xcode 8.3 which doesn't allow us to use xcrun anymore as it's deprecated. The new way suggested is to first archive the project and then export to .app. You can see the thread discussing this change here: Add support for Xcode 8.3 #2668

  2. The issue with running on device from Xcode after running with the NativeScript CLI is connected to an issue in the NativeScript IOS Runtime which we have already resolved. I'd suggest you two workarounds:

    • Recommended You can just use the newest version of the ios-runtime, where this issue is fixed:
      tns platform remove ios
      tns platform add ios@next
    • Alternative You can manually force the ios runtime to sync all files, before building/running with Xcode. This should be done every time, so I guess it's not very convenient, but still:
      tns run ios --sync-all-files

Let me know if these work for you.

Best,
Yosif

@dxshindeo
Copy link
Author

Tried both workarounds and they both work.
Thank you for the explanation, much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants