2016-09-16 9 views
1

Angular2チュー​​トリアルで以下のエラーが発生します。 TNSの医者は、なぜ、以下のエラーは大丈夫ですか?Nativescript Angular2チュー​​トリアルでエラーが発生する

'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を使用しています。

答えて

5

サンプル・食料品のプロジェクトが間もなく最新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.tsgrocery-list.component.tsファイルの一部のコードを置き換えることができます。

アプリ/共有/ステータス・バーu​​til.ts

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

アプリ/食料品/食料品リスト/食料品-list.component.ts

と交換cell.backgroundColor = UIColor.clearColor();と置き換えます。cell.backgroundColor = UIColor.clearColor;

関連する問題