O3(OzoneWalletIOS)项目
卡哇伊嘉人
发表于 2022-12-18 19:47:49
325
0
0
OzoneWalletIOS:https://github.com/CityOfZion/OzoneWalletIOS2 Q, v- Z4 k# z' q
neo-swift:https://github.com/CityOfZion/neo-swift( c' E& h0 f' h3 X
neo-wallet-address-go:https://github.com/apisit/neo-wallet-address-go
$ N# a$ K z) d$ N) P! e' o
下载 OzoneWalletIOS 项目% V! f- } F6 j1 c/ [" y* n0 ~9 P! h
下载 OzoneWalletIOS 项目到本地:: [, g' d5 @0 Z/ I* ^
下载 OzoneWalletIOS 项目* t! G! |; L. w# ~
用 Xcode 打开项目并运行:$ h- F3 s n+ ^
运行出错& S- ]7 [) V2 S6 M: n Z; a7 \
缺少文件
运行出错,发现缺少文件。打开项目目录,发现有这两个文件 Cartfile、Cartfile.resolved:
" P( V+ F9 i- _7 R h9 p; K* S
Cartfile 文件& {! ~* \( f( o# P% A' x
该项目是用 Carthage 管理 iOS 依赖库的,安装使用方法看这里,如果安装不成功请下载 Releases 版本进行安装。
打开终端,cd 到该项目目录,运行如下命令:
$ carthage update --platform iOS
0 |: }1 N$ w+ A/ l) {
$ carthage update –platform iOS 命令 K2 y! {6 G+ Q- ^# [- E
缺少的文件已下载完成
命令运行成功之后,再次运行项目:* Q3 J8 d# E! _+ h/ Q- Z; U: I8 k' l" K
info.plist 文件错误# }; N/ f! Z6 z5 i
发现 info.plist 文件读取错误,无法打开。我的解决方法是,新建一个 Project,然后把新工程里的 info.plist 文件拷贝到该项目里替换掉,然后再次运行:
Reason image not found 错误
在 Finder 里前往文件夹 ~/Library/Developer/Xcode/DerivedData ,删除缓存目录下的文件 :. G, \. q/ M" d
再次运行,发现还是同样的错误,后来发现新加的一个库文件 AutoInsetter 没有加进去:
*** Building scheme "AutoInsetter" in AutoInsetter.xcworkspace( z1 c ~2 w) [+ ?* h1 x
添加库文件 13 `7 T4 Z4 U; ]6 _, N( H
添加库文件 2
添加好后再次运行:
“networkKey” 出错
这个错误不知道怎么分析,全局搜索了一下“ networkKey”,发现是跟用户数据有关,后来整体看了一下项目,然后把项目的 Main Interface 改了一下:
1 I# I& D& [0 Q& s# t! x
修改 Main Interface+ P9 G6 O+ |: `8 i) f+ f
再一次运行:
! i4 b; m, ` Z1 A
Info.plist 文件缺少 Fabric 字段 1! P/ ~* W0 H3 s4 x& ^. l- ]
( c1 J" J& O9 I* g" L" ?# ]. i
Info.plist 文件缺少 Fabric 字段 2
开启 Background Modes:
开启 Background Modes3 D! }5 t+ ^' `: M7 c5 j- n! a v
向 Info.plist 文件添加 Fabric 字段,包含一个 String 类型的 APIKey 和一个 Array 类型的 Kits:
QQ20180131-144207@2x.png
好了,再次运行:6 O+ E3 I" [0 y# ~ A
模拟器运行界面; _; Z- p. `" n* D5 P7 e. e
终于运行成功了!!!/(ㄒoㄒ)/~~+ J# p. I. L# x& j- K
AppDelegate.swift
Channel.framework 大概是跟推送通知有关的库:; z+ D( `; Q. M; D% j
func setupChannel() {$ b. w4 v H" m4 D. L6 d# J
//O3 Development on Channel app_gUHDmimXT8oXRSpJvCxrz5DZvUisko_mliB61uda9iY+ F8 k1 M' @' w8 }9 E* N1 j* F
Channel.setup(withApplicationId: "app_gUHDmimXT8oXRSpJvCxrz5DZvUisko_mliB61uda9iY")
}7 L% H V* R; p# j
设置应用的外观样式:
func setupApperances() {
UIBarButtonItem.appearance().setTitleTextAttributes([
NSAttributedStringKey.font: ThemeManager.barButtonItemFont,
NSAttributedStringKey.foregroundColor: UserDefaultsManager.theme.primaryColor], for: .normal)9 b. P! O9 q$ ]6 O* J
UINavigationBar.appearance().largeTitleTextAttributes = [0 R4 q2 u8 _8 Z. E" Z; K5 ?
NSAttributedStringKey.foregroundColor: UserDefaultsManager.theme.textColor,* ^# M/ u9 j# q& M. |
NSAttributedStringKey.font: UIFont(name: "Avenir-Heavy", size: 32) as Any] L5 {! ]8 [; H$ p$ X
}# n1 a: }7 J7 p% n4 L
创建用户的默认配置:2 n; }$ ~9 D) U1 Y2 u) y
func registerDefaults() {1 a7 K9 ^( P$ o$ z( j& h3 W
let userDefaultsDefaults: [String: Any] = [+ Q6 K( m; K7 v0 n1 R/ L
"networkKey": "main",1 w' a3 R- C( |' B. e" h9 T1 b
"usedDefaultSeedKey": false,: M5 j* `$ r5 \! e! c
"selectedThemeKey": Theme.light.rawValue
]
UserDefaults.standard.register(defaults: userDefaultsDefaults)
}
开启网络状态监测:% I8 v& ^7 B5 r
let alertController = UIAlertController(title: "Uh oh! There is no internet connection.
成为第一个吐槽的人