Учебник Nativescript Angular2 приводит к ошибке

Я получаю следующую ошибку с учебником Angular2. TNS Doctor в порядке, тогда почему следующая ошибка?

'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.

Я использую новый 8x Xcode.


person Tampa    schedule 16.09.2016    source источник


Ответы (1)


Версия Dependences проекта sample-Groceries скоро будет обновлена ​​до последней версии NativeScript, однако вы можете открыть файл package.json и изменить следующие версии:

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

"nativescript-angular": "1.0.0"

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

Вы также должны быть уверены, что папки hooks, node_modules, platforms были удалены. В связи с этим в Xcode 8 некоторые методы теперь являются свойствами, и это вызовет проблемы, когда в проекте используется собственный код, как это происходит в примере-Groceries. В качестве временного решения вы можете заменить некоторый код в файлах status-bar-util.ts и grocery-list.component.ts.

app/shared/status-bar-util.ts

UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent; заменить на UIApplication.sharedApplication.statusBarStyle = UIStatusBarStyle.LightContent;

приложение/продукты/продуктовый-список/продуктовый-список.component.ts

cell.backgroundColor = UIColor.clearColor(); заменить на cell.backgroundColor = UIColor.clearColor;

person Nikolay Tsonev    schedule 17.09.2016