HPB钱包开发之Xcode集成
BlockGeek edited this page Apr 28, 2019
·
1 revision
由于HPB主网账户底层算法和以太坊相同,因此我们可以采用以太坊的底层算法对接HPB。熟悉以太坊的朋友都知道,以太坊提供了一个Web3.js API 中文文档的库,通过调用js的代码去实现区块链DApp的开发。
但是对于iOS的小伙伴来说,直接调用js无疑是很困难的,并且从实现上来说也很复杂。因此我们找到了一个swift代码实现的web3swift的库,通过这个我们可以使用swift语言去开发应用,这让实现变得简单。接下来,我们就以这个库为基础,详细介绍钱包的开发过程。
- 支持iOS 9.0以上系统
- 使用Xcode 9或更高版本
- swift4.1开发语言
库文件的导入使用cocoapods,详细安装步骤,请点击。
touch Podfile
目前HPB Wallet采用 web3swift 0.7.0版本,后续也会以该版本作为基础进行说明。
platform :ios, '9.0'
target '<Your Target Name>' do
use_frameworks!
pod 'web3swift', '~> 0.7.0'
end
在Podfile所在的文件夹下输入命令:
pod install
在使用的地方导入头文件。
- pod search无法搜索到类库的解决办法(找不到类库)
(1)执行pod setup
(2)删除~/Library/Caches/CocoaPods目录下的search_index.json文件
pod setup成功后会生成~/Library/Caches/CocoaPods/search_index.json文件。
终端输入rm ~/Library/Caches/CocoaPods/search_index.json
删除成功后再执行pod search
(3)执行pod search
安装好了web3swift库,接下来我们会讲解如何创建钱包。
|中文(简体)版本 | |English Version|
Basics
R&D
- HPB-Consensus-Algorithm-Election-Mechanism
- HPB-BOE-Introduction
- HPB-Consensus-Algorithm--Compare
- HPB-Gas-Mechanism
- HPB-P2P-NetWork
- HPB-JSON-RPC-API-Index
- RLP-Agreement-Extended-Reading
- Interface-of-HPB-hardware-random-number-generator
- HPB-hardware-random-number-service
HPB Dapp Development
- Quick-Start-For-HPB-Developer
- HPB-Dapps-Introductions
- HPB-EVM-Contracts-Introductions
- HPB-Extended-Reading-on-EVM-Development
- An-Introduction-to-EVM-Virtual-Machines
- HPB-Smart-Contracts-Extended-Doc
- Best-Practice-of-Accessing-HPB-Main-Network-in-JS-version
- Best-Practice-of-HPB-Main-Network-Access-Java-Version
- Best-Practice-of-HPB-Smart-Contract
- Case-of-Transmission-from-Ethereum-DAPP-to-HPB-blockchain
- How-to-Write-a-Contract-Extended-Reading
- Development-Tool--Remix-Extended-Reading
- Solidity-Language-Extended-Reading
- Token-issuance-on-HPB-MainNet
- Migrating-a-Ethereum-DApp-to-the-HPB-MainNet
HPB Wallet Development
- An-Introduction-to-HPB-Wallet
- HPB-Wallet-for-Xcode-Integration
- Creating-the-HPB-Wallet
- Generating-Mnemonics-for-HPB Wallet
- HPB-Wallet-and-Middleware-Interface
HPB Mainnet/TestNet Entry
- HPB-Development-Node-Construction-Guild
- Guide-to-Server-Security-Reinforcement
- Build Node With Docker
- HPB-Private-Chain-Building-Guide
Developer Community