O3(OzoneWalletIOS)项目
卡哇伊嘉人
发表于 2022-12-18 19:47:49
429
0
0
OzoneWalletIOS:https://github.com/CityOfZion/OzoneWalletIOS
neo-swift:https://github.com/CityOfZion/neo-swift8 X' `" h- g t( P8 l- b) U2 z
neo-wallet-address-go:https://github.com/apisit/neo-wallet-address-go7 p' U5 Y/ U1 T. e. T
下载 OzoneWalletIOS 项目$ p9 ]+ I: v0 D* _8 c: m5 a) d" M
下载 OzoneWalletIOS 项目到本地:6 ]! n& m! D2 d7 o2 }
4 K+ q0 p+ d; q4 Z& S
下载 OzoneWalletIOS 项目% h. E; T' d! p
用 Xcode 打开项目并运行:0 ^2 v: I- i9 e2 j$ c1 G
; I5 @% n' j" g+ q* B
运行出错
4 P$ p7 X8 o* Q' ~2 ~) S( K6 e
缺少文件
运行出错,发现缺少文件。打开项目目录,发现有这两个文件 Cartfile、Cartfile.resolved:
Cartfile 文件
该项目是用 Carthage 管理 iOS 依赖库的,安装使用方法看这里,如果安装不成功请下载 Releases 版本进行安装。
打开终端,cd 到该项目目录,运行如下命令:
$ carthage update --platform iOS
$ carthage update –platform iOS 命令
缺少的文件已下载完成
命令运行成功之后,再次运行项目:
info.plist 文件错误) a- b* B: l9 {
发现 info.plist 文件读取错误,无法打开。我的解决方法是,新建一个 Project,然后把新工程里的 info.plist 文件拷贝到该项目里替换掉,然后再次运行:
Reason image not found 错误
在 Finder 里前往文件夹 ~/Library/Developer/Xcode/DerivedData ,删除缓存目录下的文件 :) e2 [4 X; z6 d! ]2 }6 ]& b
再次运行,发现还是同样的错误,后来发现新加的一个库文件 AutoInsetter 没有加进去:
*** Building scheme "AutoInsetter" in AutoInsetter.xcworkspace* S/ _3 M- x: O! I
) C5 A' D: K4 ]
添加库文件 1
添加库文件 2
添加好后再次运行:
“networkKey” 出错. r. ]# u- _2 _. w% Q
这个错误不知道怎么分析,全局搜索了一下“ networkKey”,发现是跟用户数据有关,后来整体看了一下项目,然后把项目的 Main Interface 改了一下:4 m0 B% C% p. c# M& ]
' r$ E* Z' g+ g
修改 Main Interface3 Y+ a( c B: M! `2 P
再一次运行:( O6 j& v. o s1 r$ m2 A
: K( N% R& w" k6 X2 c, Q- [" I. C
Info.plist 文件缺少 Fabric 字段 1) C7 e" q# e( U2 q# N* Z
3 y2 g) }8 p& J
Info.plist 文件缺少 Fabric 字段 2
开启 Background Modes:
0 w. V& ?2 r; t! B# i" r8 ?
开启 Background Modes6 n2 X, g2 C7 v1 v% O$ z+ E: y/ G
向 Info.plist 文件添加 Fabric 字段,包含一个 String 类型的 APIKey 和一个 Array 类型的 Kits:4 S8 _8 l4 H+ p% M
QQ20180131-144207@2x.png7 t' \" i6 u2 P+ \$ N! {+ H
好了,再次运行:
9 I9 e* a7 w }) e. ^& z
模拟器运行界面
终于运行成功了!!!/(ㄒoㄒ)/~~/ u3 ?5 U& Q& \' {- T2 y/ L
AppDelegate.swift
Channel.framework 大概是跟推送通知有关的库:
func setupChannel() {. }9 m4 E8 o% M& U) |4 e, o
//O3 Development on Channel app_gUHDmimXT8oXRSpJvCxrz5DZvUisko_mliB61uda9iY
Channel.setup(withApplicationId: "app_gUHDmimXT8oXRSpJvCxrz5DZvUisko_mliB61uda9iY")& L) s& A" p- V9 w3 |
}# R! q- c7 D, r' }: w
设置应用的外观样式:' w6 t' L( u# y- ?0 s: r/ c
func setupApperances() {- g: G+ B# [6 F4 L/ q& [5 K
UIBarButtonItem.appearance().setTitleTextAttributes([
NSAttributedStringKey.font: ThemeManager.barButtonItemFont, \3 e7 T" ~6 d7 F$ B) }
NSAttributedStringKey.foregroundColor: UserDefaultsManager.theme.primaryColor], for: .normal), s8 B7 W+ V' A% c2 z6 ~2 }) d
UINavigationBar.appearance().largeTitleTextAttributes = [5 x/ I4 R& u( ~) U! [6 u
NSAttributedStringKey.foregroundColor: UserDefaultsManager.theme.textColor,
NSAttributedStringKey.font: UIFont(name: "Avenir-Heavy", size: 32) as Any]6 p1 \# n& G x! P( s, ^) {
}0 g- _" q. Y; y. i0 i" O
创建用户的默认配置:
func registerDefaults() {6 D4 U) }0 `0 D; Z
let userDefaultsDefaults: [String: Any] = [6 D8 d' J; ~( z; r
"networkKey": "main",' I3 Q: X5 n! }: `* w T# \6 y
"usedDefaultSeedKey": false,7 s9 P& s& w- E( l: Y' s+ ]8 T
"selectedThemeKey": Theme.light.rawValue4 R. S9 a! \0 @- g7 a
]& A, u3 \6 @0 Q
UserDefaults.standard.register(defaults: userDefaultsDefaults)
}
开启网络状态监测:$ [. z* r) p7 H( w
let alertController = UIAlertController(title: "Uh oh! There is no internet connection.
成为第一个吐槽的人