簡體   English   中英

在Winrt / C ++中使用AppService

[英]using AppService in winrt/c++

我試圖按照C ++ / Cx中的github示例在winrt / c ++中使用AppService。 我總是得到“ AppUnavailable”結果。 我已經確認我連接到正確的服務名稱並具有正確的家庭包裹名稱。

我的appxmanifest:

  <Extensions>
    <uap:Extension Category="windows.appService" EntryPoint="BlankApp5.Inventory">
      <uap3:AppService Name="com.microsoft.inventory" uap4:SupportsMultipleInstances="true"/>
    </uap:Extension>
  </Extensions>

我的提供程序頭文件(在Mainpage.h中):

namespace winrt::BlankApp5::implementation
{
class Inventory : public InventoryT<Inventory> {
public:
    virtual void Run(IBackgroundTaskInstance taskInstance);

private:
    BackgroundTaskDeferral mDef;
    AppServiceConnection appServiceConnection;
};

我的MainPage.idl文件:

[default_interface]
runtimeclass Inventory : Windows.ApplicationModel.Background.IBackgroundTask
{
    void Run(Windows.ApplicationModel.Background.IBackgroundTaskInstance taskInstance);
}

在生成IDL期間,我收到以下警告:

[msg]A member name has been qualified with an interface name because name collisions occurred across interface members on a runtime class. [context]"Run" has been renamed as "BlankApp5.IInventory.Run" on runtime class "BlankApp5.Inventory"

我有點擔心鏈接器剝離了Inventory :: Run,因為它不在serviceprovider內部使用,但是我不知道為什么它不起作用。 提供者和客戶端處於兩種不同的解決方案中,彼此之間沒有引用,但是我認為這不是必需的。 服務提供商已經部署,但尚未啟動。 啟動沒有區別。

您無需聲明void Run(Windows.ApplicationModel.Background.IBackgroundTaskInstance taskInstance); 在您的idl文件中,因為您實現了IBackgroundTask並且隱式聲明了一個void Run

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM