-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
2190 lines (894 loc) · 72.1 KB
/
index.html
File metadata and controls
2190 lines (894 loc) · 72.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />
<link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />
<link href="/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" />
<meta name="keywords" content="Hexo, NexT" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.2" />
<meta name="description" content="iOS开发、ReactNative开发、AR">
<meta property="og:type" content="website">
<meta property="og:title" content="DragonFly的博客">
<meta property="og:url" content="http://fighting300.com/index.html">
<meta property="og:site_name" content="DragonFly的博客">
<meta property="og:description" content="iOS开发、ReactNative开发、AR">
<meta property="og:locale" content="zh-Hans">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="DragonFly的博客">
<meta name="twitter:description" content="iOS开发、ReactNative开发、AR">
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Muse',
version: '5.1.2',
sidebar: {"position":"left","display":"post","offset":12,"offset_float":12,"b2t":false,"scrollpercent":false,"onmobile":false},
fancybox: true,
tabs: true,
motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn"}},
duoshuo: {
userId: '0',
author: '博主'
},
algolia: {
applicationID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
}
};
</script>
<link rel="canonical" href="http://fighting300.com/"/>
<title>DragonFly的博客</title>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-106064035-1', 'auto');
ga('send', 'pageview');
</script>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
<div class="container sidebar-position-left
page-home">
<div class="headband"></div>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-wrapper">
<div class="site-meta ">
<div class="custom-logo-site-title">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">DragonFly的博客</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<p class="site-subtitle">我曾七次鄙视自己的灵魂</p>
</div>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section">
<i class="menu-item-icon fa fa-fw fa-home"></i> <br />
首页
</a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories/" rel="section">
<i class="menu-item-icon fa fa-fw fa-th"></i> <br />
分类
</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags/" rel="section">
<i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
标签
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section">
<i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
归档
</a>
</li>
</ul>
</nav>
</div>
</header>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<section id="posts" class="posts-expand">
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://fighting300.com/2017/12/31/summary-about-2017/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="DragonFly">
<meta itemprop="description" content="">
<meta itemprop="image" content="/uploads/avatar.jpeg">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="DragonFly的博客">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2017/12/31/summary-about-2017/" itemprop="url">我的2017年年终总结</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2017-12-31T15:21:27+08:00">
2017-12-31
</time>
</span>
<span class="post-comments-count">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-comment-o"></i>
</span>
<a href="/2017/12/31/summary-about-2017/#comments" itemprop="discussionUrl">
<span class="post-comments-count disqus-comment-count"
data-disqus-identifier="2017/12/31/summary-about-2017/" itemprop="commentCount"></span>
</a>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>2017年的最后一天,想说的很多,下笔却感觉很是惶恐,一年从头到尾,开始的时候信心满满,到年终却又感觉很多想做的事没有完成。细细回想起来,年年如此。<br>不过一年里也算完成了一部分自己的规划,且学且行,不管从工作上还是个人成长,都有一些收获。</p>
<p>工作方面<br>作为一只程序猿,本职工作就是完成产品需求,当然不能局限自己在简单的完成工作上,还需要在业务层面帮助优化产品体验和产品流程,在技术层面提出可行性的方案,解决、跟踪和预防未来可能存在的问题,这需要从产品的规划以及公司的角度来思考,并且在技术层也要多维度思考,比如产品性能、所需资源、后续维护成本等,在本职工作的基础上,提供最合适的解决方案。这一年的工作里,慢慢的学习、思考了很多,发现自己在面对问题的时候还是有很多欠缺,不过在逐步学习中进步,不再仅仅从纯技术角度来考虑一个问题的解决方法了。</p>
<p>技术方面<br>这一年从iOS端逐渐向大前端以及全栈方向发展,学习研究和使用了Swift、ReactNative、ES5、Node.js、python等不同的语言框架,前后端都有不同成都的了解和熟悉。目前看来移动端慢慢会趋向于统一、融合,当然iOS不可能完全消失,偏底层、基础的架构还是要用objectiveC、Swift或者C++来实现。但是快速迭代的业务层肯定慢慢向可以快速迭代的前端靠拢,例如新的ReactNative、Weex等技术框架是很好的解决方案,同时旧有的Hybrid的架构还会在很长一段时间内用于拉新、推广、运营等活动。通过学习,目前Swift已经能熟悉使用,ReactNative、Weex前端框架也有一些研究和发掘,还对前端项目的架构和脚手架也做了研究和实践,发现语言和框架很多原则、原理是一致的,重要的是活学活用,不同的场景要考虑不同的方式来应对解决。<br>此外还研究了一些新技术的应用,包括AR、CoreML等,新技术的出现蕴含的新的机会,面对新技术不能浅尝辄止,需要通过使用、体验来发掘其外来可能性,并与现有业务结合,来创造出新的机会。</p>
<p>个人成长方面<br>开了博客以来,经常会有一些内容记录下来要总结,但是有时候拖延症犯了,很多文章就被堆积在草稿箱。今年慢慢的把自己之前列好的未完成的一些文章补完,发现欠的债有点多,不过在慢慢填补。总结到记录再到分享是一个循环持续的过程,通过这一个个循环,不仅能沉淀知识,也可以<br>发现自己一个很大的问题是,很多事情小有成绩就开始沾沾自喜,然后导致后续问题频出。现在都会时时自省,发现问题及时改正,不然会导致虎头蛇尾。</p>
<p>下一年的计划<br>明天开始,新的一年到来,计划要学习很多知识,技术方面重点有Swift的深入研究、深度学习,还有产品、运营等方向的学习。要把自己持续放在不断学习不断进步的环境中,才不会懈怠。<br>以前年末,总会暗自总结一番,封案待查,结果发现并不会回去翻看。现在总结发到博客,可以时时翻看,以待后验。逝者如斯夫,不舍昼夜,年终岁末,给过去的一年里的自己点个赞,下一年里继续加油,把握机会,不要犹豫,去努力追求自己想要的。</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://fighting300.com/2017/12/08/iOS-LogShowAndRedirect/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="DragonFly">
<meta itemprop="description" content="">
<meta itemprop="image" content="/uploads/avatar.jpeg">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="DragonFly的博客">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2017/12/08/iOS-LogShowAndRedirect/" itemprop="url">iOS中的日志同步获取-NSLog重定向及其他</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2017-12-08T21:13:48+08:00">
2017-12-08
</time>
</span>
<span class="post-comments-count">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-comment-o"></i>
</span>
<a href="/2017/12/08/iOS-LogShowAndRedirect/#comments" itemprop="discussionUrl">
<span class="post-comments-count disqus-comment-count"
data-disqus-identifier="2017/12/08/iOS-LogShowAndRedirect/" itemprop="commentCount"></span>
</a>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>我们在真机测试时经常会发现一个难题是无法查看真机的<code>NSLog</code>类型的实时日志,这时候需要RD复现问题来定位当时的日志,以方便查找问题。这个问题在测试中是非常常见的,也是功能测试会花费比较长时间的一个原因。以下我们讨论下能即时查看日志的几种方案。</p>
<h5 id="NSLog输出到哪里?"><a href="#NSLog输出到哪里?" class="headerlink" title="NSLog输出到哪里?"></a>NSLog输出到哪里?</h5><p>在iOS开发中,我们经常会用到NSLog调试,但是我们却不太了解它。在NSLog本质是一个C函数,它的函数声明如下:<br><code>FOUNDATION_EXPORT void NSLog(NSString *format, ...)</code><br>系统对它的说明是:<code>Logs an error message to the Apple System Log facility.</code>。他是用来输出信息到标准Error控制台上去的,其内部其实是使用<code>Apple System Log</code>的API。在调试阶段,日志会输出到到Xcode中,而在iOS真机上,它会输出到系统的<code>/var/log/syslog</code>这个文件中。</p>
<p>在iOS中,把日志输出到文件中的句柄在<code>unistd.h</code>文件中有定义:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">#define STDIN_FILENO 0 /* standard input file descriptor */</span><br><span class="line">#define STDOUT_FILENO 1 /* standard output file descriptor */</span><br><span class="line">#define STDERR_FILENO 2 /* standard error file descriptor */</span><br></pre></td></tr></table></figure></p>
<p>NSLog输出的是到<code>STDERR_FILENO</code>上,我们可以在iOS中使用c语言输出到的文件的<code>fprintf</code>来验证:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">NSLog(@"iOS NSLog");</span><br><span class="line">fprintf (stderr, "%s\n", "fprintf log");</span><br></pre></td></tr></table></figure></p>
<p>由于fprintf并不会像NSLog那样,在内部调用ASL接口,所以只是单纯的输出信息,并没有添加日期、进程名、进程id等,也不会自动换行。</p>
<!--noindex-->
<div class="post-button text-center">
<a class="btn" href="/2017/12/08/iOS-LogShowAndRedirect/#more" rel="contents">
阅读全文 »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://fighting300.com/2017/09/30/tools-MagicaVoxel-model/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="DragonFly">
<meta itemprop="description" content="">
<meta itemprop="image" content="/uploads/avatar.jpeg">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="DragonFly的博客">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2017/09/30/tools-MagicaVoxel-model/" itemprop="url">快速创建ARKit模型-使用MagicaVoxel创建3D模型</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2017-09-30T13:55:31+08:00">
2017-09-30
</time>
</span>
<span class="post-category" >
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/Tool/" itemprop="url" rel="index">
<span itemprop="name">Tool</span>
</a>
</span>
</span>
<span class="post-comments-count">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-comment-o"></i>
</span>
<a href="/2017/09/30/tools-MagicaVoxel-model/#comments" itemprop="discussionUrl">
<span class="post-comments-count disqus-comment-count"
data-disqus-identifier="2017/09/30/tools-MagicaVoxel-model/" itemprop="commentCount"></span>
</a>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>iOS APP尤其是游戏中,还有新发布的ARKit中,2D/3D模型需要花费大量的时间来创建,然而我们开发者开没有那么长时间。<br>最近发现一款及其简单的模型创建工具-MagicaVoxel,虽然他只能创建<code>体素(Voxel)</code>模型,但是生成的模型可以在ARKit中使用,而且它还是免费的。<br>下面我们介绍下该软件。</p>
<p><img src="http://ojca2gwha.bkt.clouddn.com/MagicaVoxel-example4.png" alt="Voxel模型"></p>
<h4 id="开始使用"><a href="#开始使用" class="headerlink" title="开始使用"></a>开始使用</h4><p>可能你会疑惑体素是什么意思,其实体素类似与像素,像素英文为Pixel,是图片pictures(pix)与元素element(el)俩词组合而来,而体素Voxel则由体积Volumes(vox)与元素element(el)组成。尤其是当你玩过<code>我的世界</code>的话,很快就能理解,里面的模型其实由一个个体素构成,它是一种极其简单、快速创建3D模型的方式。而MagicaVoxel就是一种创建Voxel模型的工具。</p>
<p>你可以从该地址下载MagicaVoxel: <a href="https://ephtracy.github.io,然后解压它。" target="_blank" rel="noopener">https://ephtracy.github.io,然后解压它。</a><br>当你在Mac上运行APP发现黑屏时,你需要把<code>MagicaVoxel-mac.app</code>文件移出当前目录,再移动回来,就可以解决黑屏问题。 </p>
<!--noindex-->
<div class="post-button text-center">
<a class="btn" href="/2017/09/30/tools-MagicaVoxel-model/#more" rel="contents">
阅读全文 »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://fighting300.com/2017/09/27/iOS-DeviceCheck-newUuid/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="DragonFly">
<meta itemprop="description" content="">
<meta itemprop="image" content="/uploads/avatar.jpeg">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="DragonFly的博客">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2017/09/27/iOS-DeviceCheck-newUuid/" itemprop="url">iOS11 DeviceCheck-苹果的微型云服务?</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2017-09-27T11:20:47+08:00">
2017-09-27
</time>
</span>
<span class="post-category" >
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/iOS/" itemprop="url" rel="index">
<span itemprop="name">iOS</span>
</a>
</span>
</span>
<span class="post-comments-count">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-comment-o"></i>
</span>
<a href="/2017/09/27/iOS-DeviceCheck-newUuid/#comments" itemprop="discussionUrl">
<span class="post-comments-count disqus-comment-count"
data-disqus-identifier="2017/09/27/iOS-DeviceCheck-newUuid/" itemprop="commentCount"></span>
</a>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>iOS系统一致以来都致力于保护用户的隐私安全,从UUID到VenderId,再到Mac地址,每个开发者都在探索能跟踪用户和设备的唯一标志符,可惜自从UUID别限制使用以后,到现在还没有一个类似当初UUID的标志符。</p>
<p>不过在iOS11中新增了DeviceCheck的framework,可以允许你通过自己的服务器与Apple服务器通讯,并为单个设备设置(per Device、per Developer)两个bit的数据(bit是计算机表示信息的最小单元,吐槽下真的很小,相当于只能保存两个bool值)。该framework为追踪用户提供了更好的选择,不过目前看来只能存储类似用户是否使用过优惠码的信息,或者当前设备是否涉嫌刷单等欺诈行为。</p>
<p><img src="http://ojca2gwha.bkt.clouddn.com/DeviceCheck-bits.png" alt="DeviceCheck 2bits"> </p>
<h4 id="iOS集成介绍"><a href="#iOS集成介绍" class="headerlink" title="iOS集成介绍"></a>iOS集成介绍</h4><p>DeviceCheck使用的基本流程如下:<br>1.在App内使用DeviceCheck APIs获取一个临时的token来标志该设备(很快会失效)<br>2.将token传递给后端服务器,随后后端服务器使用该token和认证后的key值(来自Apple的证书请求模块)请求Apple服务器,来更新或查询该设备的值<br>3.Apple服务器返回后端服务器信息,获取该设备之前存储的信息,包含bits信息和最后一次修改的时间戳 </p>
<p><img src="http://ojca2gwha.bkt.clouddn.com/DeviceCheck-flow.png" alt="DeviceCheck 流程"> </p>
<p>在服务端,需要使用Http Post请求来查询和更新信息,每个请求对应的header应该包含认证后的来自Apple的key值(JWT,JSON web token)。要获取该token,可以使用类似Apple推送服务(APNs)的类似流程来操作,具体流程可以参考<a href="https://help.apple.com/xcode/mac/current/#/dev54d690a66" target="_blank" rel="noopener">Communicate with APNs using authentication tokens</a>。</p>
<p>服务端请求的API请参照<a href="https://developer.apple.com/documentation/devicecheck/accessing_and_modifying_per_device_data?changes=latest_minor" target="_blank" rel="noopener">Accessing and modifying Per-Device Data</a>,数据payload的格式如下图示例:</p>
<p><img src="http://ojca2gwha.bkt.clouddn.com/DeviceCheck-payload.png" alt="服务端请求payLoad"></p>
<p>Apple API地址:<br>开发环境: <a href="https://api.development.devicecheck.apple.com" target="_blank" rel="noopener">https://api.development.devicecheck.apple.com</a><br>线上环境: <a href="https://api.devicecheck.apple.com" target="_blank" rel="noopener">https://api.devicecheck.apple.com</a>.</p>
<p>请求完整后就可以获取/更新最新的设备信息了,之后可以使用该信息进行业务操作。</p>
<h4 id="API使用"><a href="#API使用" class="headerlink" title="API使用"></a>API使用</h4><p>目前发现该API在Swift中无法使用,可能是目前的一个bug。不过可以通过桥oc代码的方式运行在Swift项目中。代码示例如下: </p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">+ (NSString *)getNewDeviceId {</span><br><span class="line"> if ([DCDevice.currentDevice isSupported]) {</span><br><span class="line"> [DCDevice.currentDevice generateTokenWithCompletionHandler:^(NSData * _Nullable token, NSError * _Nullable error) {</span><br><span class="line"> if (error) {</span><br><span class="line"> NSLog(@"%@", error.description);</span><br><span class="line"> } else {</span><br><span class="line"> // upload token to APP server</span><br><span class="line"> NSString *deviceToken = [token base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];</span><br><span class="line"> NSLog(@"%lu %@", token.length, deviceToken);</span><br><span class="line"> }</span><br><span class="line"> }];</span><br><span class="line"> }</span><br><span class="line"> return @"";</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<h5 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h5><ol>
<li><a href="https://developer.apple.com/documentation/devicecheck" target="_blank" rel="noopener">https://developer.apple.com/documentation/devicecheck</a></li>
<li><a href="https://developer.apple.com/documentation/devicecheck/accessing_and_modifying_per_device_data?changes=latest_minor" target="_blank" rel="noopener">https://developer.apple.com/documentation/devicecheck/accessing_and_modifying_per_device_data?changes=latest_minor</a></li>
</ol>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://fighting300.com/2017/09/18/ollvm-with-StringObfuscate/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="DragonFly">
<meta itemprop="description" content="">
<meta itemprop="image" content="/uploads/avatar.jpeg">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="DragonFly的博客">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2017/09/18/ollvm-with-StringObfuscate/" itemprop="url">iOS混淆-ollvm中添加对String的混淆</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2017-09-18T15:58:09+08:00">
2017-09-18
</time>
</span>
<span class="post-category" >
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/LLVM/" itemprop="url" rel="index">
<span itemprop="name">LLVM</span>
</a>
</span>
</span>
<span class="post-comments-count">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-comment-o"></i>
</span>
<a href="/2017/09/18/ollvm-with-StringObfuscate/#comments" itemprop="discussionUrl">
<span class="post-comments-count disqus-comment-count"
data-disqus-identifier="2017/09/18/ollvm-with-StringObfuscate/" itemprop="commentCount"></span>
</a>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>之前<a href="http://fighting300.github.io/2017/09/07/ollvm-in-iOS/" target="_blank" rel="noopener">研究ollvm</a>的时候,发现开源的ollvm库中没有对字符串混淆的部分,但是很多APP中都可能会有一些需要加密的字符串。机缘巧合发现上海交大的GoSSIP小组开源了他们设计的基于LLVM4.0的<a href="https://github.com/GoSSIP-SJTU/Armariris" target="_blank" rel="noopener">混淆框架</a>,功能包含常量字符串混淆以及ollvm原有的一些功能。<a href="https://zhuanlan.zhihu.com/p/27617441" target="_blank" rel="noopener">该页面</a>有关于他们项目的简介👍。<br>简单分析发现字符串混淆的部分主要由字符串加密的Pass完成,之后我们考虑把字符串混淆的功能加入ollvm中,所以本文简单介绍下如何将字符串加密的Pass继承到ollvm中。Pass其实可以简单的理解为LLVM优化/转换工作的一个最小单元,可以把所有的混淆工作都是由一个一个Pass组成的,想要做具体的了解,可以看下以下<a href="http://www.nagain.com/activity/article/14/" target="_blank" rel="noopener">专栏的文章</a>。</p>
<h4 id="Pass集成"><a href="#Pass集成" class="headerlink" title="Pass集成"></a>Pass集成</h4><p>首先提取字符串加密文件对应pass文件,该文件所在目录为lib/Transform/Obfuscation。<br><img src="http://ojca2gwha.bkt.clouddn.com/ollvm-string-cpp.png" alt="pass文件目录"></p>
<!--noindex-->
<div class="post-button text-center">
<a class="btn" href="/2017/09/18/ollvm-with-StringObfuscate/#more" rel="contents">
阅读全文 »
</a>
</div>
<!--/noindex-->
</div>