簡體   English   中英

如何使用 ionic 檢查手機中是否安裝了 Metamask 錢包?

[英]How do I check if Metamask Wallet is installed in phone using ionic?

我想知道手機中是否安裝了 Metamask 錢包應用程序。 這是我的代碼:

const { value } = await AppLauncher.canOpenUrl({ url: 'metamask-blockchain-wallet://' });

我正在我的 iOS 設備中對此進行測試。 我還在 info.plist 中添加了LSApplicationQueriesSchemes

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>metamask-blockchain-wallet</string>
</array>

我收到此錯誤:

-canOpenURL:URL 失敗:“metamask-blockchain-wallet://”- 錯誤:“操作無法完成。(OSStatus 錯誤 -10814。)”

如果我使用更改LSApplicationQueriesSchemes ,例如:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>metamask</string>
</array>

我收到一條錯誤消息

-canOpenURL:URL 失敗:“metamask-blockchain-wallet://”- 錯誤:“不允許此應用查詢方案 metamask-blockchain-wallet”

我該如何解決?

所以我找到了這個問題的答案。 錯誤中給出了解決方案。 我在canOpenUrl()LSApplicationQueriesSchemes中提供了錯誤的 URL 方案。 我剛剛用 metamask 替換了 metamask- blockchain -wallet ,它就像一個魅力。

const { value } = await AppLauncher.canOpenUrl({ url: 'metamask://' });

在 info.plist 中

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>metamask</string>
</array>

(應該有辦法讓開發者找到url 方案,適用於應用程序商店和谷歌游戲商店上可用的應用程序!)

暫無
暫無

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

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