1

I am getting the below error with the Angular2 tutorial. TNS Doctor is ok then why the below error?

'tns livesync ios --emulator --watch
Executing before-prepare hook from /Users//Documents/frontend/sample-Groceries/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 1.8.10
Project successfully prepared (ios)
Executing before-livesync hook from /Users//Documents/frontend/sample-Groceries/hooks/before-livesync/nativescript-angular-sync .js
Transferring project files...
Successfully transferred all files.
Applying changes...
Successfully synced application org.nativescript.groceries on device D28D29C3-07B6-4B60-B4B0-711475C505DE.
Executing before-watch hook from /Users//Documents/frontend/sample-Groceries/hooks/before-watch/nativescript-dev-typescript.js
Found peer TypeScript 1.8.10
Sep 17 07:34:37 Davids-iMac sampleGroceries[2934]: 1   0x105cd08d7 -[TNSRuntime executeModule:]
Sep 17 07:34:37 Davids-iMac sampleGroceries[2934]: 2   0x10587b6d2 main
Sep 17 07:34:37 Davids-iMac sampleGroceries[2934]: 3   0x109be668d start
Sep 17 07:34:37 Davids-iMac sampleGroceries[2934]: 4   0x1
Sep 17 07:34:37 Davids-iMac sampleGroceries[2934]: file:///app/tns_modules/utils/utils.js:130:72: JS ERROR TypeError: UIDevice.currentDevice is not a function. (In 'UIDevice.currentDevice()', 'UIDevice.currentDevice' is an instance of UIDevice)
Sep 17 07:34:37 Davids-iMac com.apple.CoreSimulator.SimDevice.D28D29C3-07B6-4B60-B4B0-711475C505DE.launchd_sim[2849] (UIKitApplication:org.nativescript.groceries[0xe746][2934]): Service exited due to Segmentation fault: 11
7:34:38 AM - Compilation complete. Watching for file changes.

I am using the new 8x Xcode.

1 Answer 1

5

Dependences version of the sample-Groceries project will be updated to the latest NativeScript version soon, however you could open your package.json file and change the following versions:

tns-ios": {"version": "2.3.0"}

"nativescript-angular": "1.0.0"

"tns-core-modules": "2.3.0".

You should also be sure that hooks, node_modules, platforms folders has been deleted. In regard to that, With Xcode 8 some of the methods now are properties and that will cause issues when native code has been used in the project as it does in the sample-Groceries. As a temporary solution you could replace some code in the status-bar-util.ts and grocery-list.component.ts files.

app/shared/status-bar-util.ts

UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent; replace with UIApplication.sharedApplication.statusBarStyle = UIStatusBarStyle.LightContent;

app/groceries/grocery-list/grocery-list.component.ts

cell.backgroundColor = UIColor.clearColor(); replace with cell.backgroundColor = UIColor.clearColor;

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.