Nativescript Angular2教程导致错误
我在Angular2教程中得到以下错误。TNS医生还好,那么为什么会出现以下错误Nativescript Angular2教程导致错误,nativescript,angular2-nativescript,Nativescript,Angular2 Nativescript,我在Angular2教程中得到以下错误。TNS医生还好,那么为什么会出现以下错误 '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 succ
'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。示例杂货项目的Dependences版本将很快更新为最新的NativeScript版本,但是您可以打开package.json文件并更改以下版本:
tns-ios:{“版本”:“2.3.0”}
“nativescript angular”:“1.0.0”
“tns核心模块”:“2.3.0”
您还应该确保挂钩
,节点_模块
,平台
文件夹已被删除。关于这一点,对于Xcode 8,现在的一些方法是属性,当本机代码在项目中使用时会导致问题,就像在示例杂货店中一样。作为临时解决方案,您可以在状态栏util.ts
和杂货店列表.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;
示例杂货项目的依赖项版本将很快更新为最新的NativeScript版本,但是您可以打开package.json文件并更改以下版本:
tns-ios:{“版本”:“2.3.0”}
“nativescript angular”:“1.0.0”
“tns核心模块”:“2.3.0”
您还应确保已删除挂钩
,节点_模块
,平台
文件夹。考虑到这一点,对于Xcode 8,一些方法现在是属性,当本机代码在项目中使用时,就像在示例杂货店中一样,会导致问题。作为临时解决方案,您可以替换状态栏util.ts
和杂货店列表.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代码>