Hi 游客

更多精彩,请登录!

比特池塘 区块链技术 正文

O3(OzoneWalletIOS)项目

卡哇伊嘉人
423 0 0
The main repo for the O3 wallet on iOS.
$ h$ @1 B, f4 B( c6 u5 YOzoneWalletIOS:https://github.com/CityOfZion/OzoneWalletIOS
) D* u0 p9 Z; R5 f* g1 g+ b. Tneo-swift:https://github.com/CityOfZion/neo-swift/ A9 Y9 d. G- ^2 q1 u5 m- n
neo-wallet-address-go:https://github.com/apisit/neo-wallet-address-go
% g0 K* R+ s( ]
6 }2 t  @: B0 W9 Y下载 OzoneWalletIOS 项目- m& `# D% z# ^+ f
下载 OzoneWalletIOS 项目到本地:
4 e# ~' A) _' e1 U  o9 Q) l% t4 b9 b1 t$ z0 p) b
下载 OzoneWalletIOS 项目# i+ d/ o7 o0 L: ]) ?
用 Xcode 打开项目并运行:
2 P" O5 g9 {' I+ R  [) {  y( B$ f/ \- {3 P" t
运行出错5 d3 l- E: r0 q
7 L' h2 D- s; w$ v5 a. X
缺少文件
! m  {: y- o: X0 h# p& T3 x运行出错,发现缺少文件。打开项目目录,发现有这两个文件 Cartfile、Cartfile.resolved:
9 i/ }# y: i+ }* R  w7 `: C) d6 G4 g3 k5 N+ F1 K6 Y7 I
Cartfile 文件" B" W( X+ i7 v- `- k: q
该项目是用 Carthage 管理 iOS 依赖库的,安装使用方法看这里,如果安装不成功请下载 Releases 版本进行安装。
7 j. u  @: n' ^) j" d3 C打开终端,cd 到该项目目录,运行如下命令:, e# i. c: K7 _2 D
$ carthage update --platform iOS
7 C/ |$ B9 {" k! w' z  e4 M0 q9 F  f7 ~/ o* u& i0 i( N- s! t
$ carthage update –platform iOS 命令
# V  {6 h  J! O& [+ r$ W0 ~9 O9 V! O" |
缺少的文件已下载完成
# W& v/ w9 w1 ^) Q8 g9 g命令运行成功之后,再次运行项目:9 p+ t) `* [3 {# n/ Z3 }

2 l. W- F5 [' l( j+ K1 ^info.plist 文件错误& ]: R3 W* m7 h
发现 info.plist 文件读取错误,无法打开。我的解决方法是,新建一个 Project,然后把新工程里的 info.plist 文件拷贝到该项目里替换掉,然后再次运行:  ~3 [. m8 c4 f- H& `% K7 n
( M2 t5 e/ P9 ?
Reason image not found 错误
% U7 z/ N& m/ k8 S! w1 P在 Finder 里前往文件夹 ~/Library/Developer/Xcode/DerivedData ,删除缓存目录下的文件 :/ ]+ ]. u4 p  C5 w2 R8 t
( E8 Y) G( n. s3 u
再次运行,发现还是同样的错误,后来发现新加的一个库文件 AutoInsetter 没有加进去:
+ \7 ]5 R0 R8 R" ?*** Building scheme "AutoInsetter" in AutoInsetter.xcworkspace
3 e0 S% B' L$ _6 R5 n6 {+ N7 l1 `6 B: }8 `4 a3 @
添加库文件 1/ D* W" G  d, ]
0 T" a( \7 O" ~
添加库文件 2+ {* x0 ^  A; b1 H4 }
添加好后再次运行:
9 N" v( O6 ]+ E6 E& @  g# {. Q/ V& u1 w/ O
“networkKey” 出错
* P& {7 k* T( d. P, a这个错误不知道怎么分析,全局搜索了一下“ networkKey”,发现是跟用户数据有关,后来整体看了一下项目,然后把项目的 Main Interface 改了一下:% K, y. H' U0 E7 T( [' D

7 V0 ]! @- Z& |* \, E8 f8 x, L% j修改 Main Interface
  ]; |; O+ |6 c" i& G再一次运行:
5 G  _- {# _9 o) V2 t; \6 @+ L; P+ d$ k3 \! t8 [
Info.plist 文件缺少 Fabric 字段 1
2 y, ?' i  |  c" A, |, j- C! y) l( x* a" M3 F! e
Info.plist 文件缺少 Fabric 字段 2( U! ~* M) C, j' N
开启 Background Modes:
! U* p4 g, I# `3 x4 {5 s& R
1 t* J: P$ x8 h! O1 s5 H2 B# }开启 Background Modes
/ f) H! ^0 f0 Y$ ~  R向 Info.plist 文件添加 Fabric 字段,包含一个 String 类型的 APIKey 和一个 Array 类型的 Kits:
! P( ~9 D0 @2 K- c! P* F" J, `; ~/ [$ b) s  H2 Y3 N
QQ20180131-144207@2x.png
: J) K% c" s: O4 p0 k  L- I好了,再次运行:
0 x. s" p& n  T  ^
; k) r4 n. a- ]模拟器运行界面% X5 Y9 m  b& @! Q- O# B
终于运行成功了!!!/(ㄒoㄒ)/~~
/ v0 p' ?4 ~2 P& T2 UAppDelegate.swift
6 s) c& V; Q, Y" i+ U4 r# K) `Channel.framework 大概是跟推送通知有关的库:
, O3 \7 k6 k( }* U& v" d) o- x) rfunc setupChannel() {+ F, j8 q$ ~2 x
        //O3 Development on Channel app_gUHDmimXT8oXRSpJvCxrz5DZvUisko_mliB61uda9iY) P3 L6 h( T0 L  E/ |
        Channel.setup(withApplicationId: "app_gUHDmimXT8oXRSpJvCxrz5DZvUisko_mliB61uda9iY")6 E! F+ W8 F; y0 b: y/ N; Y! J0 i
    }2 {; j7 s% u* x) S9 W4 f4 C+ s
设置应用的外观样式:
* a. d! A; ~/ y  Jfunc setupApperances() {" i( i6 e% y. N, ]
        UIBarButtonItem.appearance().setTitleTextAttributes([# ~% M4 n- Z& _: T. f  f
            NSAttributedStringKey.font: ThemeManager.barButtonItemFont,3 w) Q+ ?9 _% A$ n2 x
            NSAttributedStringKey.foregroundColor: UserDefaultsManager.theme.primaryColor], for: .normal)
1 D! E. Z% ^1 |  ^: ~5 k9 `3 ?        UINavigationBar.appearance().largeTitleTextAttributes = [
% t" {/ a% {, j( j+ x            NSAttributedStringKey.foregroundColor: UserDefaultsManager.theme.textColor,2 g7 Z9 {9 s5 u) R
            NSAttributedStringKey.font: UIFont(name: "Avenir-Heavy", size: 32) as Any]; N+ I( V; g  |% B' ^
    }+ R& ~  k. v6 _, T  k+ ]1 ^6 P
创建用户的默认配置:
' N& }, n2 ~+ gfunc registerDefaults() {8 E9 P% B. x) A" `! c
        let userDefaultsDefaults: [String: Any] = [
' m3 b; f1 N& H            "networkKey": "main",
! x+ q4 }: K  h: n            "usedDefaultSeedKey": false,
% u2 l9 \6 W2 `3 T* ?& ~; G            "selectedThemeKey": Theme.light.rawValue$ b9 p+ l5 q8 e/ Y& H
        ]  f4 i3 ~, {' a  t( M
        UserDefaults.standard.register(defaults: userDefaultsDefaults)( K- `# _  X* ]2 f' {
    }. T- ~( y+ `  f% N
开启网络状态监测:
3 c# |& c) M: q2 N, A5 wlet alertController = UIAlertController(title: "Uh oh! There is no internet connection.
BitMere.com 比特池塘系信息发布平台,比特池塘仅提供信息存储空间服务。
声明:该文观点仅代表作者本人,本文不代表比特池塘立场,且不构成建议,请谨慎对待。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

成为第一个吐槽的人

卡哇伊嘉人 初中生
  • 粉丝

    0

  • 关注

    0

  • 主题

    11