博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ios启动私有链查询区块信息
阅读量:7124 次
发布时间:2019-06-28

本文共 1824 字,大约阅读时间需要 6 分钟。

  hot3.png

一、新建一个ios swift项目

二、下载并安装CocoaPods.app-1.5.2.tar.bz2

https://github.com/CocoaPods/CocoaPods-app/releases/download/1.5.2/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!)")

========================================

四、问题汇总

1、真机build faile

解决:all + Combined ,搜索bitcode,enable bitcode讲yes修改为no

========================================

转载于:https://my.oschina.net/duojin/blog/1842946

你可能感兴趣的文章
syslog介绍(二):Linux下syslog基本配置
查看>>
Packet Tracer 5.0实验(六) 路由器基本配置
查看>>
Instructions函数对照表:01 mmintrin.h与MMX指令集
查看>>
C/C++函数调用过程分析
查看>>
Servlet总结
查看>>
c++调用java时得到java签名的方法javap -s -p <classname>
查看>>
Linux下查看apache连接数
查看>>
HDU 3660 Alice and Bob's Trip
查看>>
android 获取手机中所有的传感器Sensor类使用方法
查看>>
JavaScript基础 ( 3 章 )
查看>>
HTML5标签
查看>>
在移位数组中查找数
查看>>
GNU make manual 翻译(九十九)
查看>>
c/c++:关于typedef的用法总结
查看>>
泛型和反射
查看>>
HDU 4285 circuits 第37届ACM/ICPC天津赛区网络赛(插头DP)
查看>>
UIlabel 最小字体设置。
查看>>
HUST 1017 Exact cover 跳舞链(DLX) 模板题目
查看>>
[原]Node.js小试
查看>>
第44周星期四小结
查看>>