本篇內容介紹了“ios啟動私有鏈查詢區塊信息的方法是什么”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!
一、新建一個ios swift項目
二、下載并安裝CocoaPods.app-1.5.2.tar.bz2
三、通過pod安裝geth插件
$ cd /Users/shijun/Desktop/iosWorkspace/BlockChain
$ pod init
生成Podfile文件,并修改內容
target 'BlockChain' do
pod 'Geth', '1.8.12' #加這行
use_frameworks!
target 'BlockChainTests' do
pod 'Geth', '1.8.12' #加這行
inherit! :search_paths
end
target 'BlockChainUITests' do
pod 'Geth', '1.8.12' #加這行
inherit! :search_paths
end
end
$ pod install
========================================
Analyzing dependencies
Downloading dependencies
Installing Geth (1.8.12)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `BlockChain.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
[!] Automatically assigning platform `ios` with version `11.4` on target `BlockChain` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
========================================
四、ios代碼
創建新帳號
========================================
import Geth
let keyStorePath = "/Users/shijun/Desktop/blockChain/ethereum/private/data0/keystore"
print("keyStorePath: \(keyStorePath)")
let keyStoreManager = GethNewKeyStore(keyStorePath, GethLightScryptN, GethLightScryptP)
let account = try! keyStoreManager?.newAccount("password")
let address = account?.getAddress().getHex()
print("address: \(address!)")
let url = account?.getURL()
print("url: \(url!)")
========================================
四、問題匯總
真機build faile
解決:all + Combined ,搜索bitcode,enable bitcode講yes修改為no
========================================
“ios啟動私有鏈查詢區塊信息的方法是什么”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。