-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
818 lines (510 loc) · 33 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ray's blog</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description">
<meta property="og:type" content="website">
<meta property="og:title" content="Ray's blog">
<meta property="og:url" content="http://woohyuknrg.github.io/index.html">
<meta property="og:site_name" content="Ray's blog">
<meta property="og:description">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Ray's blog">
<meta name="twitter:description">
<link rel="icon" href="favicon.png">
<link href='//fonts.useso.com/css?family=Open+Sans:400italic,400,600' rel='stylesheet' type='text/css'>
<link href="//fonts.useso.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/css/style.css" type="text/css">
<link rel="stylesheet" href="/font-awesome/css/font-awesome.min.css" type="text/css">
</head>
<body>
<div id="container">
<header id="header">
<div id="header-main" class="header-inner">
<div class="outer">
<a href="/" id="logo"><i class="logo" style="background-image: url(/css/images/logo.png)"></i><span class="site-title">Ray's blog</span></a>
<nav id="main-nav">
<a class="main-nav-link" href="/.">首页</a>
<a class="main-nav-link" href="/archives">归档</a>
<a class="main-nav-link" href="/categories">分类</a>
<a class="main-nav-link" href="/tags">标签</a>
</nav>
<nav id="sub-nav">
<div class="profile" id="profile-nav">
<a id="profile-anchor" href="javascript:;"><img class="avatar" src="/css/images/avatar.png"><i class="fa fa-caret-down"></i></a>
</div>
</nav>
<div id="search-form-wrap">
<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit"> </button><input type="hidden" name="sitesearch" value="http://woohyuknrg.github.io"></form>
</div>
</div>
</div>
<div id="main-nav-mobile" class="header-sub header-inner">
<table class="menu outer">
<tr>
<td><a class="main-nav-link" href="/.">首页</a></td>
<td><a class="main-nav-link" href="/archives">归档</a></td>
<td><a class="main-nav-link" href="/categories">分类</a></td>
<td><a class="main-nav-link" href="/tags">标签</a></td>
<td>
<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><input type="hidden" name="sitesearch" value="http://woohyuknrg.github.io"></form>
</td>
</tr>
</table>
</div>
</header>
<div class="outer">
<aside id="profile">
<div class="inner profile-inner">
<div class="base-info profile-block">
<img id="avatar" src="/css/images/avatar.png">
<h2 id="name">Ray</h2>
<h3 id="title">iOS Developer</h3>
<span id="location"><i class="fa fa-map-marker"></i>Chengdu, China</span>
<a id="follow" href="https://github.com/woohyuknrg/">关注我</a>
</div>
<div class="article-info profile-block">
<div class="article-info-block">
9
<span>文章</span>
</div>
<div class="article-info-block">
15
<span>标签</span>
</div>
</div>
<div class="contact-info profile-block">
<table class="contact-list">
<tr>
<td><a href="https://github.com/woohyuknrg" target="_blank" title="github"><i class="fa fa-github"></i></a></td>
<td><a href="/atom.xml" target="_blank" title="rss"><i class="fa fa-rss"></i></a></td>
</tr>
</table>
</div>
</div>
</aside>
<section id="main">
<article id="post-project-to-swift2-3" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2016/09/17/project-to-swift2-3/">项目迁移至swift2.3并适配iOS10</a>
</h1>
<div class="article-meta">
<div class="article-date">
<i class="fa fa-calendar"></i>
<a href="/2016/09/17/project-to-swift2-3/">
<time datetime="2016-09-17T12:19:39.000Z" itemprop="datePublished">2016-09-17</time>
</a>
</div>
<div class="article-category">
<i class="fa fa-folder"></i>
<a class="article-category-link" href="/categories/swift/">swift</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p>因为项目里用到的有些第三方库还没有兼容swift3,所以只有先迁移到swift2.3,过程记录如下:<br>
<p class="article-more-link">
<a href="/2016/09/17/project-to-swift2-3/#more">继续阅读</a>
</p>
</div>
<footer class="article-footer">
<a data-url="http://woohyuknrg.github.io/2016/09/17/project-to-swift2-3/" data-id="cit7a97ss00090joicnw4kv6f" class="article-share-link">分享到</a>
<a href="http://woohyuknrg.github.io/2016/09/17/project-to-swift2-3/#ds-thread" class="article-comment-link">评论</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Xcode8/">Xcode8</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/iOS10/">iOS10</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/swift2-3/">swift2.3</a></li></ul>
</footer>
</div>
</article>
<article id="post-spaceship" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2016/08/24/spaceship/">使用spaceship批量添加设备并更新profile</a>
</h1>
<div class="article-meta">
<div class="article-date">
<i class="fa fa-calendar"></i>
<a href="/2016/08/24/spaceship/">
<time datetime="2016-08-24T06:50:42.000Z" itemprop="datePublished">2016-08-24</time>
</a>
</div>
<div class="article-category">
<i class="fa fa-folder"></i>
<a class="article-category-link" href="/categories/ios/">ios</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p>在公司经历过同时需要添加多个设备并更新profile,幸得有<a href="https://github.com/fastlane/fastlane/tree/master/spaceship">spaceship</a>相助,写了个脚本UpdateProfile.rb:</p>
<pre><code><span class="built_in">require</span> <span class="string">"spaceship"</span>
Spaceship.login(<span class="string">'APPLE ID'</span>, <span class="string">'password'</span>)
<span class="comment">#参数传入true表示需要新增设备,例如:ruby UpdateProfile.rb true</span>
<span class="keyword">if</span> ARGV[<span class="number">0</span>] == <span class="string">"true"</span>
<span class="built_in">file</span> = File.<span class="built_in">open</span>(<span class="string">"multiple-device-upload-ios.txt"</span>) <span class="comment">#文本文件里录入的udid和设备名用tab分隔</span>
<span class="built_in">file</span>.<span class="keyword">each</span> <span class="built_in">do</span> |<span class="built_in">line</span>|
arr = <span class="built_in">line</span>.strip.<span class="built_in">split</span>(<span class="string">"\t"</span>)
device = Spaceship.device.<span class="built_in">create</span>!(name: arr[<span class="number">1</span>], udid: arr[<span class="number">0</span>])
puts <span class="string">"add device: #{device.name} #{device.udid} #{device.model}"</span>
<span class="function"><span class="keyword">end</span>
<span class="title">devices</span> = <span class="title">Spaceship</span>.<span class="title">device</span>.<span class="title">all</span></span>
profiles = Array.<span class="built_in">new</span>
profiles += Spaceship.provisioning_profile.development.all
profiles += Spaceship.provisioning_profile.ad_hoc.all
profiles.<span class="keyword">each</span> <span class="built_in">do</span> |p|
puts <span class="string">"Updating #{p.name}"</span>
p.devices = devices
p.update!
<span class="function"><span class="keyword">end</span>
<span class="title">end</span></span>
dic = { <span class="string">"XXXAdHoc"</span> => <span class="string">"773086ad-6b7b-4e57-85b7-08b577308e91.mobileprovision"</span>,
<span class="string">"XXXDevelop"</span> => <span class="string">"a7a85aa7-f359-4415-a8ed-3dacc31ea448.mobileprovision"</span> }
downloadProfiles = Array.<span class="built_in">new</span>
downloadProfiles += Spaceship.provisioning_profile.development.all
downloadProfiles += Spaceship.provisioning_profile.ad_hoc.all
downloadProfiles.<span class="keyword">each</span> <span class="built_in">do</span> |p|
puts <span class="string">"Downloading #{p.name}"</span>
fileName = dic[p.name]
File.<span class="built_in">write</span>(<span class="string">"/Users/ray/Library/MobileDevice/Provisioning Profiles/#{fileName}"</span>, p.download)
<span class="keyword">end</span>
</code></pre>
<p class="article-more-link">
<a href="/2016/08/24/spaceship/#more">继续阅读</a>
</p>
</div>
<footer class="article-footer">
<a data-url="http://woohyuknrg.github.io/2016/08/24/spaceship/" data-id="cit7a97sy000i0joifwl1sg9c" class="article-share-link">分享到</a>
<a href="http://woohyuknrg.github.io/2016/08/24/spaceship/#ds-thread" class="article-comment-link">评论</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/spaceship/">spaceship</a></li></ul>
</footer>
</div>
</article>
<article id="post-server-with-swift" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2016/03/23/server-with-swift/">swift + vapor写服务器</a>
</h1>
<div class="article-meta">
<div class="article-date">
<i class="fa fa-calendar"></i>
<a href="/2016/03/23/server-with-swift/">
<time datetime="2016-03-23T12:43:38.000Z" itemprop="datePublished">2016-03-23</time>
</a>
</div>
<div class="article-category">
<i class="fa fa-folder"></i>
<a class="article-category-link" href="/categories/swift/">swift</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p><a href="http://www.cocoachina.com/swift/20160318/15712.html">参考文章</a></p>
<p><a href="https://github.com/loganwright/swift-server-io">示例demo</a></p>
<p><a href="https://github.com/qutheory/vapor">vapor</a></p>
<p>看了参考文章写的用swift写服务器,自己跟着做了一遍,踩了不少坑,于是记录成文:</p>
<h2 id="下载安装swift开发版的snapshot">下载安装swift开发版的snapshot</h2><p><a href="https://swift.org/download/">swift官网</a></p>
<p>此处有坑,不要下载最新的3.16号的安装包,要下载和vapor使用版本一致的包,可打开vapor里的.swift-version文件查看其使用版本,目前使用的是:<br><a href="https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a/swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a-osx.pkg">https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a/swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a-osx.pkg</a></p>
<h2 id="添加环境变量">添加环境变量</h2><p>若使用的是Xcode7.3:<code>export TOOLCHAINS=swift</code></p>
<p>或者使用Xcode7.2:<code>PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:$PATH</code></p>
<p>添加后执行:<code>swift --version</code>,确认显示为:<code>Apple Swift version 3.0-dev</code></p>
<p>再执行:<code>swift build --version</code>,确认显示为:<code>Apple Swift Package Manager 0.1</code></p>
<p>若出现以下错误(下载DEVELOPMENT-SNAPSHOT-2016-03-16-a的包会出这个问题,我最初下载的3.16的包,遇到这个问题,一并记录在这儿;下载安装3.1的包不会有该问题):</p>
<blockquote>
<p>dyld: Library not loaded: @rpath/libswiftCore.dylib<br>Referenced from: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-16-a.xctoolchain/usr/bin/swift-build<br>Reason: image not found</p>
</blockquote>
<p><a href="http://blog.yourtion.com/install-swift-and-solve-library-not-loaded.html">解决办法</a>,添加环境变量:<br><code>export DYLD_LIBRARY_PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/lib/swift/macosx:$DYLD_LIBRARY_PATH</code></p>
<p class="article-more-link">
<a href="/2016/03/23/server-with-swift/#more">继续阅读</a>
</p>
</div>
<footer class="article-footer">
<a data-url="http://woohyuknrg.github.io/2016/03/23/server-with-swift/" data-id="cit7a97t4000m0joi7mbb0r34" class="article-share-link">分享到</a>
<a href="http://woohyuknrg.github.io/2016/03/23/server-with-swift/#ds-thread" class="article-comment-link">评论</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Heroku/">Heroku</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/swift/">swift</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/vapor/">vapor</a></li></ul>
</footer>
</div>
</article>
<article id="post-ioskai-fa-trick" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2015/01/10/ioskai-fa-trick/">ios开发trick</a>
</h1>
<div class="article-meta">
<div class="article-date">
<i class="fa fa-calendar"></i>
<a href="/2015/01/10/ioskai-fa-trick/">
<time datetime="2015-01-10T02:30:17.000Z" itemprop="datePublished">2015-01-10</time>
</a>
</div>
<div class="article-category">
<i class="fa fa-folder"></i>
<a class="article-category-link" href="/categories/ios/">ios</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p>译自:<a href="http://nshipster.com/new-years-2015/">http://nshipster.com/new-years-2015/</a></p>
<h2 id="成员函数的秘密">成员函数的秘密</h2><p>swift类和结构体的成员函数总是有以下2种等价调用形式:</p>
<pre><code>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>].reverse()
Array.reverse([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>])()
</code></pre>
<p class="article-more-link">
<a href="/2015/01/10/ioskai-fa-trick/#more">继续阅读</a>
</p>
</div>
<footer class="article-footer">
<a data-url="http://woohyuknrg.github.io/2015/01/10/ioskai-fa-trick/" data-id="cit7a97t8000u0joir6fgwhin" class="article-share-link">分享到</a>
<a href="http://woohyuknrg.github.io/2015/01/10/ioskai-fa-trick/#ds-thread" class="article-comment-link">评论</a>
</footer>
</div>
</article>
<article id="post-ios-weekly-report-1" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2014/11/08/ios-weekly-report-1/">ios weekly report 1</a>
</h1>
<div class="article-meta">
<div class="article-date">
<i class="fa fa-calendar"></i>
<a href="/2014/11/08/ios-weekly-report-1/">
<time datetime="2014-11-08T03:45:33.000Z" itemprop="datePublished">2014-11-08</time>
</a>
</div>
<div class="article-category">
<i class="fa fa-folder"></i>
<a class="article-category-link" href="/categories/ios/">ios</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p><a href="https://github.com/kaishin/ImageScout" target="_blank" rel="external">ImageScout</a>:下载最少的数据来获取网络图片的尺寸和类型,支持png,gif,jpg。swift实现,兼容ios7+</p>
<p><a href="https://github.com/KrauseFx/deliver" target="_blank" rel="external">deliver</a>:命令行一键发布ipa,上传截图,关键字等,还支持持续集成单元测试</p>
<p><a href="http://useyourloaf.com/blog/2014/11/02/continuous-integration-with-xcode-server.html" target="_blank" rel="external">使用Xcode Server持续集成</a></p>
<p><a href="http://www.bignerdranch.com/blog/core-graphics-part-1-in-the-beginning/" target="_blank" rel="external">Core Graphics讲堂第一课(连载)</a></p>
</div>
<footer class="article-footer">
<a data-url="http://woohyuknrg.github.io/2014/11/08/ios-weekly-report-1/" data-id="cit7a97tb000w0joinnf6zgp0" class="article-share-link">分享到</a>
<a href="http://woohyuknrg.github.io/2014/11/08/ios-weekly-report-1/#ds-thread" class="article-comment-link">评论</a>
</footer>
</div>
</article>
<article id="post-reveal" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2014/04/13/reveal/">Reveal</a>
</h1>
<div class="article-meta">
<div class="article-date">
<i class="fa fa-calendar"></i>
<a href="/2014/04/13/reveal/">
<time datetime="2014-04-13T03:19:25.000Z" itemprop="datePublished">2014-04-13</time>
</a>
</div>
<div class="article-category">
<i class="fa fa-folder"></i>
<a class="article-category-link" href="/categories/ios/">ios</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p>Reveal早有耳闻,今天装了个reveal插件,可自动编译运行app时启动reveal,但是运行发现其仅能在模拟器环境下使用,于是改了下其代码,使其即可在模拟器也可在真机上运行:</p>
<p class="article-more-link">
<a href="/2014/04/13/reveal/#more">继续阅读</a>
</p>
</div>
<footer class="article-footer">
<a data-url="http://woohyuknrg.github.io/2014/04/13/reveal/" data-id="cit7a97td000y0joic1yxikne" class="article-share-link">分享到</a>
<a href="http://woohyuknrg.github.io/2014/04/13/reveal/#ds-thread" class="article-comment-link">评论</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Reveal/">Reveal</a></li></ul>
</footer>
</div>
</article>
<article id="post-c-plus-plus" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2014/04/07/c-plus-plus/">c++ basic for ioser</a>
</h1>
<div class="article-meta">
<div class="article-date">
<i class="fa fa-calendar"></i>
<a href="/2014/04/07/c-plus-plus/">
<time datetime="2014-04-07T12:22:36.000Z" itemprop="datePublished">2014-04-07</time>
</a>
</div>
<div class="article-category">
<i class="fa fa-folder"></i>
<a class="article-category-link" href="/categories/ios/">ios</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p><a href="http://www.raywenderlich.com/62990/introduction-c-ios-developers-part-2">原文链接</a></p>
<h2 id="虚函数">虚函数</h2><p>先来看个错误示例:</p>
<pre><code><span class="keyword">class</span> Foo {
<span class="keyword">public</span>:
<span class="function"><span class="keyword">int</span> <span class="title">value</span><span class="params">()</span> </span>{ <span class="keyword">return</span> <span class="number">5</span>; }
};
<span class="keyword">class</span> Bar : <span class="keyword">public</span> Foo {
<span class="keyword">public</span>:
<span class="function"><span class="keyword">int</span> <span class="title">value</span><span class="params">()</span> </span>{ <span class="keyword">return</span> <span class="number">10</span>; }
};
Bar *b = <span class="keyword">new</span> Bar();
Foo *f = (Foo*)b;
<span class="built_in">printf</span>(“%i”, f->value());<span class="comment">// Output = 5</span>
</code></pre><p>期望输出为10,可是输出5;要想使输出为10,就需要用到虚函数,正确示例如下:</p>
<pre><code><span class="keyword">class</span> Foo {
<span class="keyword">public</span>:
<span class="function"><span class="keyword">virtual</span> <span class="keyword">int</span> <span class="title">value</span><span class="params">()</span> </span>{ <span class="keyword">return</span> <span class="number">5</span>; }
};
<span class="keyword">class</span> Bar : <span class="keyword">public</span> Foo {
<span class="keyword">public</span>:
<span class="function"><span class="keyword">virtual</span> <span class="keyword">int</span> <span class="title">value</span><span class="params">()</span> </span>{ <span class="keyword">return</span> <span class="number">10</span>; }
};
</code></pre>
<p class="article-more-link">
<a href="/2014/04/07/c-plus-plus/#more">继续阅读</a>
</p>
</div>
<footer class="article-footer">
<a data-url="http://woohyuknrg.github.io/2014/04/07/c-plus-plus/" data-id="cit7a97th00120join143lrrm" class="article-share-link">分享到</a>
<a href="http://woohyuknrg.github.io/2014/04/07/c-plus-plus/#ds-thread" class="article-comment-link">评论</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/c/">c++</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/ios/">ios</a></li></ul>
</footer>
</div>
</article>
<article id="post-mac-plus-github-plus-octopressda-jian-bo-ke" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2014/02/18/mac-plus-github-plus-octopressda-jian-bo-ke/">mac+github+octopress搭建博客</a>
</h1>
<div class="article-meta">
<div class="article-date">
<i class="fa fa-calendar"></i>
<a href="/2014/02/18/mac-plus-github-plus-octopressda-jian-bo-ke/">
<time datetime="2014-02-18T07:32:23.000Z" itemprop="datePublished">2014-02-18</time>
</a>
</div>
<div class="article-category">
<i class="fa fa-folder"></i>
<a class="article-category-link" href="/categories/other/">other</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p><a href="http://beyondvincent.com/2013/08/03/2013-08-03-108-creating-a-github-blog-using-octopress/">参考文章</a></p>
<p>费了不少周折,最终ok,现将注意事项记录如下:</p>
<h2 id="安装ruby">安装ruby</h2><p>由于我的mac早前已经有了ruby环境,只要保证版本在1.9.3以上即可。可执行:<code>ruby -v</code>确认版本号,若已经安装了ruby环境,则参考文章里第一步安装ruby的指令都可以不执行了。</p>
<h2 id="安装octopress">安装octopress</h2><p>参考文章里这句指令可以不执行:<code>rbenv rehash</code>,除非你是使用rbenv来安装的ruby环境</p>
<p class="article-more-link">
<a href="/2014/02/18/mac-plus-github-plus-octopressda-jian-bo-ke/#more">继续阅读</a>
</p>
</div>
<footer class="article-footer">
<a data-url="http://woohyuknrg.github.io/2014/02/18/mac-plus-github-plus-octopressda-jian-bo-ke/" data-id="cit7a97tm00180joi6frqo0g9" class="article-share-link">分享到</a>
<a href="http://woohyuknrg.github.io/2014/02/18/mac-plus-github-plus-octopressda-jian-bo-ke/#ds-thread" class="article-comment-link">评论</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/github/">github</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/mac/">mac</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/octopress/">octopress</a></li></ul>
</footer>
</div>
</article>
<article id="post-ce-shi-kuang-jia-kif" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2014/02/18/ce-shi-kuang-jia-kif/">测试框架KIF</a>
</h1>
<div class="article-meta">
<div class="article-date">
<i class="fa fa-calendar"></i>
<a href="/2014/02/18/ce-shi-kuang-jia-kif/">
<time datetime="2014-02-18T03:05:15.000Z" itemprop="datePublished">2014-02-18</time>
</a>
</div>
<div class="article-category">
<i class="fa fa-folder"></i>
<a class="article-category-link" href="/categories/ios/">ios</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p><a href="https://github.com/kif-framework/KIF" target="_blank" rel="external">项目地址</a></p>
<p>看功能介绍很强大,能模拟用户交互事件(例如点击,拖动)进行测试等。<br>自己按照其使用说明,无论是通过cocoapods集成,还是直接把xcodeproj拖到自己项目的workspace里,该设置的参数都设置了,均无法test编译通过。</p>
<p>网上也搜了下解决方案,把<strong>sentestkit</strong>也加入了<strong>link binary</strong>,还是不行,始终编译报错undefined symbols for i386。</p>
<p>若用同仁成功集成使用了KIF,还望赐教,多谢多谢!</p>
</div>
<footer class="article-footer">
<a data-url="http://woohyuknrg.github.io/2014/02/18/ce-shi-kuang-jia-kif/" data-id="cit7a97oo00000joip67uguce" class="article-share-link">分享到</a>
<a href="http://woohyuknrg.github.io/2014/02/18/ce-shi-kuang-jia-kif/#ds-thread" class="article-comment-link">评论</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/KIF/">KIF</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/单元测试/">单元测试</a></li></ul>
</footer>
</div>
</article>
</section>
<aside id="sidebar">
<div class="widget-wrap">
<h3 class="widget-title">分类</h3>
<div class="widget">
<ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/ios/">ios</a><span class="category-list-count">6</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/other/">other</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/swift/">swift</a><span class="category-list-count">2</span></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">标签</h3>
<div class="widget">
<ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Heroku/">Heroku</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/KIF/">KIF</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Reveal/">Reveal</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Xcode8/">Xcode8</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c++</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/github/">github</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/iOS10/">iOS10</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ios/">ios</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mac/">mac</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/octopress/">octopress</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/spaceship/">spaceship</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/swift/">swift</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/swift2-3/">swift2.3</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vapor/">vapor</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/单元测试/">单元测试</a><span class="tag-list-count">1</span></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">归档</h3>
<div class="widget">
<ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/09/">九月 2016</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/08/">八月 2016</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">三月 2016</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/01/">一月 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/11/">十一月 2014</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/04/">四月 2014</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/">二月 2014</a><span class="archive-list-count">2</span></li></ul>
</div>
</div>
<div class="widget-wrap widget-list">
<h3 class="widget-title">链接</h3>
<div class="widget">
<ul>
<li>
<a href="http://blog.csdn.net/woohyuknrg" target="_blank">woohyuknrg的专栏</a>
</li>
<li>
<a href="http://blog.163.com/ray_jun" target="_blank">ray_jun的博客</a>
</li>
</ul>
</div>
</div>
<div id="toTop" class="fa fa-chevron-up"></div>
</aside>
</div>
<footer id="footer">
<div class="outer">
<div id="footer-info" class="inner">
© 2015 - 2016 Ray<br>
Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>. Theme by <a href="http://github.com/ppoffice">PPOffice</a>
</div>
</div>
</footer>
<script type="text/javascript">
var duoshuoQuery = {short_name:"woohyuknrg"};
(function() {
var ds = document.createElement('script');
ds.type = 'text/javascript';ds.async = true;
ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
ds.charset = 'UTF-8';
(document.getElementsByTagName('head')[0]
|| document.getElementsByTagName('body')[0]).appendChild(ds);
})();
</script>
<script src="//ajax.useso.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css" type="text/css">
<script src="/fancybox/jquery.fancybox.pack.js" type="text/javascript"></script>
<script src="/js/script.js" type="text/javascript"></script>
</div>
</body>
</html>