Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1265] Can't build Windows Store app using JavaScript against native Windows API

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionCannot Reproduce
Resolution Date2015-12-27T06:05:23.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
LabelsHyperloop, Windows
ReporterToshiro Yagi
AssigneeSharif AbuDarda
Created2015-12-17T19:34:03.000+0000
Updated2016-03-08T07:37:39.000+0000

Description

Should I abandon native API call using JavaScript? Build fails with this simple code:
var win = require('Windows.UI.Xaml.Window');
Build command: {noformat} C:\Users\toshiro\Documents\Appcelerator_Studio_Workspace\TestApp>appc ti build -p windows -T ws-local -P MYPASSWORD -R generated.pfx {noformat} Error log: {noformat} [INFO] Alloy compiled in 16.01656s [INFO] Alloy compiler completed successfully [INFO] Missing 3 app icons, generating missing icons [INFO] Square44x44Logo.png - Used for logo - size: 44x44 [INFO] Square71x71Logo.png - Used for logo - size: 71x71 [INFO] Square150x150Logo.png - Used for logo - size: 150x150 [INFO] Processing JavaScript files [INFO] Detected native API reference: Windows.UI.Xaml.Window [INFO] Generating i18n files [INFO] Generating Native Type Wrappers [WARN] Unable to find metadata for: Platform.Object [WARN] Something went wrong. No metadata for type: Windows.Foundation.IAsyncOperation1<T> [WARN] Something went wrong. No metadata for type: Platform.Object [WARN] Something went wrong. No metadata for type: Windows.Foundation.IAsyncOperationWithProgress2 [WARN] Unable to find metadata for: Platform.Object [WARN] Unable to find metadata for: Platform.Object [WARN] Unable to find metadata for: Platform.Object [WARN] Unable to find metadata for: Platform.Object [WARN] Unable to find metadata for: Platform.Object [WARN] Unable to find metadata for: Platform.Object No metadata found for: Windows.Foundation.Collections.IKeyValuePair2<string,class Windows.Storage.Streams.RandomAccessStreamReference> No metadata found for: Windows.Foundation.Collections.IKeyValuePair2 No metadata found for: Windows.Foundation.Collections.IKeyValuePair2<string,class Windows.Storage.Streams.RandomAccessStreamReference> No metadata found for: Windows.Foundation.Collections.IKeyValuePair2 No metadata found for: Windows.Foundation.Collections.IKeyValuePair2<string,object> No metadata found for: Windows.Foundation.Collections.IKeyValuePair2 No metadata found for: Windows.Foundation.Collections.IKeyValuePair2<string,object> No metadata found for: Windows.Foundation.Collections.IKeyValuePair2 No metadata found for: Windows.Foundation.Collections.IKeyValuePair`2 [INFO] Setting up native modules for CMakeLists.txt... [INFO] Writing appxmanifest C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Package.store.appxmanifest.in [INFO] Writing appxmanifest C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Package.phone.appxmanifest.in [INFO] Writing appxmanifest C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Package.win10.appxmanifest.in [INFO] Writing CMakeLists.txt: C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\CMakeLists.txt [INFO] Running cmake at C:\ProgramData\Titanium\mobilesdk\win32\6.0.0.v20151216093835\windows\cli\vendor\cmake\bin\cmake.exe in directory C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86 [INFO] -- The C compiler identification is MSVC 18.0.31010.0 [INFO] -- The CXX compiler identification is MSVC 18.0.31010.0 [INFO] -- Check for working C compiler using: Visual Studio 14 2015 [INFO] -- Check for working C compiler using: Visual Studio 14 2015 -- works [INFO] -- Detecting C compiler ABI info [INFO] -- Detecting C compiler ABI info - done [INFO] -- Check for working CXX compiler using: Visual Studio 14 2015 [INFO] -- Check for working CXX compiler using: Visual Studio 14 2015 -- works [INFO] -- Detecting CXX compiler ABI info [INFO] -- Detecting CXX compiler ABI info - done [INFO] -- Detecting CXX compile features [INFO] -- Detecting CXX compile features - done [INFO] -- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) [INFO] -- Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) [INFO] -- Performing Test COMPILER_HAS_DEPRECATED_ATTR [INFO] -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed [INFO] -- Performing Test COMPILER_HAS_DEPRECATED [INFO] -- Performing Test COMPILER_HAS_DEPRECATED - Failed [INFO] -- Configuring done [INFO] -- Generating done [INFO] -- Build files have been written to: C:/Users/toshiro/.titanium/vsbuild/DNPKitchenSink/store.x86 [INFO] Running MSBuild on solution: C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\DNPKitchenSink.sln [WARN] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.ApplicationModel.DataTransfer.DataPackage.cpp(224): warning C4973: 'Windows::ApplicationModel::DataTransfer::IDataPackage::SetUri' : 非推奨として設定されています [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindows_Native.vcxproj] [WARN] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.ApplicationModel.DataTransfer.DataPackageView.cpp(254): warning C4973: 'Windows::ApplicationModel::DataTransfer::IDataPackageView::GetUriAsync' : 非推奨として設定されています [C:\Users\toshiro\.titaniu [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFile.cpp(195): error C2039: 'StorageProvider' : 'Titanium::Windows::Storage' のメンバーではありません。 [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindo [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFile.cpp(195): error C2065: 'StorageProvider' : 定義されていない識別子です。 [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindows_Native.vcxproj] [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFile.cpp(195): error C2923: 'HAL::JSExport' : 'StorageProvider' は、有効な テンプレート 型引数 (パラメーター 'T') ではありません。 [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\T [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFile.cpp(196): error C2039: 'StorageProvider' : 'Titanium::Windows::Storage' のメンバーではありません。 [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindows_Native.vcxproj] [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFile.cpp(196): error C2065: 'StorageProvider' : 定義されていない識別子です。 [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindows_Native.vcxproj] [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFile.cpp(196): error C2974: 'HAL::JSObject::GetPrivate' : テンプレート 引数が 'T' に対して無効です。型が必要です [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindows_Native.vcxproj] [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFile.cpp(197): error C3536: 'result_wrapper': 初期化前に使用することはできません [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindows_Native.vcxproj] [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFile.cpp(197): error C2227: '->wrap' : 左側がクラス、構造体、共用体、ジェネリック型へのポインターではありません。 [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindows_Native.vcxp [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFolder.cpp(174): error C2039: 'StorageProvider' : 'Titanium::Windows::Storage' のメンバーではありません。 [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindows_Native.vcxproj] [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFolder.cpp(174): error C2065: 'StorageProvider' : 定義されていない識別子です。 [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindows_Native.vcxproj] [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFolder.cpp(174): error C2923: 'HAL::JSExport' : 'StorageProvider' は、有効な テンプレート 型引数 (パラメーター 'T') ではありません。 [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindows_Native.vcxproj] [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFolder.cpp(175): error C2039: 'StorageProvider' : 'Titanium::Windows::Storage' のメンバーではありません。 [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindows_Native.vcxproj] [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFolder.cpp(175): error C2065: 'StorageProvider' : 定義されていない識別子です。 [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindows_Native.vcxproj] [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFolder.cpp(175): error C2974: 'HAL::JSObject::GetPrivate' : テンプレート 引数が 'T' に対して無効です。型が必要です [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindo [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFolder.cpp(176): error C3536: 'result_wrapper': 初期化前に使用することはできません [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindows_Native.vcxproj] [ERROR] C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\Native\src\Windows.Storage.StorageFolder.cpp(176): error C2227: '->wrap' : 左側がクラス、構造体、共用体、ジェネリック型へのポインターではありません。 [C:\Users\toshiro\.titanium\vsbuild\DNPKitchenSink\store.x86\Native\TitaniumWindows_Native.vc {noformat}

Comments

  1. Sharif AbuDarda 2015-12-22

    Hello, Please provide full sample code and explain what you are trying to do. We will try to regenerate the issue. Thanks.
  2. Toshiro Yagi 2015-12-22

    Hi, I'm trying examples described here: https://docs.appcelerator.com/platform/latest/#!/guide/Windows_Runtime_Direct_API_Access You can reproduce this error by adding just one line to automatically generated index.js file. So it goes like this:
       function doClick(e) {
           alert($.label.text);
       }
       var win = require('Windows.UI.Xaml.Window');
       $.index.open();
       
  3. Sharif AbuDarda 2015-12-24

    Hello, I tested the native Windows API. It working as expected with the example code provided below.
       var Window = require('Windows.UI.Xaml.Window'),
           TextBlock = require('Windows.UI.Xaml.Controls.TextBlock'),
           window = Window.Current,
           text = new TextBlock();
       text.Text = "Click me, please!";
       // For enum values, you do not need to require in the class
       // See the next section
       text.TextAlignment = Windows.UI.Xaml.TextAlignment.Center;
       text.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center;
       text.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
       text.FontSize = 60;
       window.Content = text;
       window.Activate();
       
    Though the first time you build a project that includes WinRT APIs, the first build is slow (will take several minutes). For me it took 15 mins. I also tried your code, and your log doesn't show any error, which is also working. According to documentation "The first time you build a project that includes WinRT APIs, the first build will be slow (will take several minutes). Subsequent builds should be faster even if you add more WinRT classes. ". So wait for the application to build. Thanks.
  4. Toshiro Yagi 2016-01-12

    I guess you built app for windows phone or windows phone simulator, not for Windows App Store. As I wrote above post, it does not work when you build app with -T ws-local option.

JSON Source