iOS10上传AppStore所遇到的坑

苹果的反馈邮件:
Dear developer,
We have discovered one or more issues with your recent delivery for “城满财富”. To process your delivery, the following issues must be corrected:
This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSContactsUsageDescription key with a string value explaining to the user how the app uses this data.
This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSCalendarsUsageDescription key with a string value explaining to the user how the app uses this data.
This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSBluetoothPeripheralUsageDescription key with a string value explaining to the user how the app uses this data.
This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSMicrophoneUsageDescription key with a string value explaining to the user how the app uses this data.
This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.
This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSMotionUsageDescription key with a string value explaining to the user how the app uses this data.
Though you are not required to fix the following issues, we wanted to make you aware of them:
Missing Push Notification Entitlement - Your app includes an API for Apple’s Push Notification service, but the aps-environment entitlement is missing from the app’s signature. To resolve this, make sure your App ID is enabled for push notification in the Provisioning Portal. Then, sign your app with a distribution provisioning profile that includes the aps-environment entitlement. This will create the correct signature, and you can resubmit your app. See “Provisioning and Development” in the Local and Push Notification Programming Guide for more information. If your app does not use the Apple Push Notification service, no action is required. You may remove the API from future submissions to stop this warning. If you use a third-party framework, you may need to contact the developer for information on removing the API.
Once the required corrections have been made, you can then redeliver the corrected binary.
Regards,
The App Store team

看一下苹果的官方描述:
You must statically declare your app’s intended use of protected data classes by including the appropriate purpose string keys in your Info.plist file. For example, you must include the NSCalendarsUsageDescription key to access the user’s Calendar data. If you don’t include the relevant purpose string keys, your app exits when it tries to access the data.
解决方案:

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
<!-- 🖼 Photo Library -->
<key>NSPhotoLibraryUsageDescription</key>
<string>请点击“允许”以允许访问</string>

<!-- 📷 Camera -->
<key>NSCameraUsageDescription</key>
<string></string>

<!-- 🎤 Microphone -->
<key>NSMicrophoneUsageDescription</key>
<string></string>

<!-- 📍 Location -->
<key>NSLocationUsageDescription</key>
<string></string>

<!-- 📍 Location When In Use -->
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>

<!-- 📍 Location Always -->
<key>NSLocationAlwaysUsageDescription</key>
<string></string>

<!-- 📆 Calendars -->
<key>NSCalendarsUsageDescription</key>
<string></string>

<!-- ⏰ Reminders -->
<key>NSRemindersUsageDescription</key>
<string></string>

<!-- 🏊 Motion -->
<key>NSMotionUsageDescription</key>
<string></string>

<!-- 💊 Health Update -->
<key>NSHealthUpdateUsageDescription</key>
<string></string>

<!-- 💊 Health Share -->
<key>NSHealthShareUsageDescription</key>
<string></string>

<!-- ᛒ🔵 Bluetooth Peripheral -->
<key>NSBluetoothPeripheralUsageDescription</key>
<string></string>

<!-- 🎵 Media Library -->
<key>NSAppleMusicUsageDescription</key>
<string></string>

之间的描述一定要填写

RxSwift ———– 项目实战

前言

RxSwift 源自ReactiveX,它蕴含了深刻的FRP思想,这是一个崭新的世界,我也是慕名而来,本着好学的心态,叩开RxSwift的大门,来了之后才发现,这里人迹罕至,路上满是泥泞,坑坑洼洼,幸好遇到了RxExample, 从此便奉为圭皋,仔细研读,跟随者开拓者的足迹,我也进行了一次RxSwift之旅,其中酸甜苦辣,请亲自品尝。

装备

装备的选择对你趟坑过河的影响还是蛮大的,选好内裤,走起路来便可以雄赳赳气昂昂。 我选择的内裤便是 Moya、Alamofire、ObjectMapper 等,有了这些内裤,你便可以优雅的踩坑。

出发

作为一个swifter Alamofire 对你来说并不陌生,它的优雅与简洁没有多少库能出其左右,然而对于 Moya 你可能未必熟悉,不过你不熟悉也没关系,协议和扩展造就了他的优雅与平易近人,你可以轻松的用它来封装你的网络请求层,他与Alamofire 也是不离不弃.
如果想获取信息,那么你需这样做:

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
enum OSCIOService {
case NewsList, NewBanner, TweetList, BlogList, EventList, EventBanner
case Login(username: String, password: String)
case FindUser(name: String)
case Search(content: String)
}

extension OSCIOService: TargetType {

var baseURL: NSURL {
// return NSURL(string: "http://www.oschina.net/action/api")! //XML格式
return NSURL(string: "http://www.oschina.net/action/apiv2")! //JSON格式
}

var path: String {
switch self {
case .NewsList:
return "/news"
case .NewBanner:
return "/banner"
case .TweetList:
return "/tweet_list"
case .BlogList:
return "/blog_list"
case .EventList:
return "/event_list"
case .EventBanner:
return "/banner"
case .Login( _, _):
return "/login_validate"
case .FindUser(_):
return "/find_user"
case .Search(_):
return "/search_list"
}
}

var method: Moya.Method {
switch self {
case .Login:
return .POST
default:
return .GET
}
}

var parameters: [String: AnyObject]? {
switch self {
case .Login(let username, let password):
return ["username": username, "pwd": password]
case .NewBanner:
return ["catalog": 1]
case .EventBanner:
return ["catalog": 3]
case .FindUser(let name):
return ["name":name]
default:
return nil
}
}

var sampleData: NSData {
return "{}".dataUsingEncoding(NSUTF8StringEncoding)! // for test
}

var multipartBody: [MultipartFormData]? {
return nil
}
}

这样就可以封装好你的API了
既然我们来到的FRP的路上,那么我们应该也改改以前惯用的MVC了,MVVM 才是更优雅的姿势,那个问题来了,我们的viewModel 呢?别着急,请看下面:

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
class NewsViewModel {
var provider: RxMoyaProvider<OSCIOService>
var backgroundScheduler: OperationQueueScheduler!


init() {
let operationQueue = NSOperationQueue()
backgroundScheduler = OperationQueueScheduler(operationQueue: operationQueue)
self.provider = RxMoyaProvider<OSCIOService>()
}

func fetch() -> Observable<[NewsItem]?> {
return Observable.create({ observer -> Disposable in
self.provider.request(OSCIOService.NewsList) { response in
switch response {
case let .Success(response):
let result = Mapper<NewsRootClass>().map(String(data: response.data, encoding: NSUTF8StringEncoding))
observer.on(Event.Next(result?.result?.items))
case let .Failure(error):
observer.on(Event.Error(error))
}
observer.onCompleted()
}
return NopDisposable.instance
})
}
}

在viewModel中我提供了一个网络 Observable 以供外部订阅,将数据转化为可以订阅的Stream
那么这样我们就可以到 Controller 进行数据订阅了:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
let viewModel = NewsViewModel()
viewModel.fetch().subscribe(
onNext: { entities in
if let result = entities {
self.newsItems = result
}
log.info("你好")
}, onError: { error in
log.error("\(error)")
}, onCompleted: {
log.info("completed")
}, onDisposed: {
log.info("disposed")

}).addDisposableTo(self.disposeBag)

当我们拿到了数据,我们就可以进行数据展示了,这与我们常规的数据展示不无差别
好了,由于文字功底有限,我就不赘述了

完整项目可移步:https://github.com/CNKCQ

相关资料:
https://mcxiaoke.gitbooks.io/rxdocs/content/
https://github.com/ReactiveX/RxSwift/blob/master/Documentation/GettingStarted.md
http://cocoadocs.org/docsets/RxCocoa/1.5/index.html
https://coderwall.com/p/vti_8w/rxswift-learning-resources
https://leon_lizi.gitbooks.io/rx-/content/observableyu_alamofire.html
http://www.oschina.net/openapi/docs/

iOS设计编码规范

1, iOS 常用系统控件

1.0.1 Status Bar 状态栏


状态栏的信息内容有两种不同的风格:暗色(黑)和亮色(白):

1.0.2 Navigation Bar 导航栏

导航栏总在屏幕的顶部,状态栏的正下方。默认的,导航栏背景会进行轻微半透明处理,以及对下面的内容进行毛玻璃般的模糊处理:

1.0.3 Tab Bar 标签栏

标签栏在屏幕底部。默认情况下背景使用和导航栏一样的轻微半透明效果,以及使用和系统一样的模糊处理下面遮住的内容。:

1.0.4 Table View 表格视图

表格视图用于呈现大多数列表风格的信息,可以一列或者多列,也可以选择几行来划分信息或分组。
纯表格:


分组表格(头部和尾部字体:13pt):


默认:


系统自带cell 默认中高度 44pt

带副标题:


带数值:


表格视图每一行cell选中自带高亮

1.0.5 Alerts 警告提醒

警告提醒用于通知用户关键信息,以及可以强制用户做出一些动作选择。
警告视图总包含一个标题文本,可以不限于一行(对于纯信息警告如“OK”),以及不限一个或两个按钮(请求式的决定,如“发送”和“取消”)。:

1.0.6 Actions Sheets 动作菜单

用于从可执行的动作中选择执行一个动作,要求App用户选择一个动作继续,或者取消。:

1.0.7 Switch 开关

用于从可执行的动作中选择执行一个动作,要求App用户选择一个动作继续,或者取消。:

1.0.8 Search Bar 搜索栏

搜索栏默认有两种风格:凸显(Prominent)和最小(Minimal)风格。两种风格的功能都相同。:
(无提示栏、有提示栏)


(最小风格的搜索栏)

1.0.9 Edit menu 编辑菜单

在一个元素被选定时(文本,图片及其他),编辑菜单允许用户执行复制、粘贴、剪切等操作:

1.1.1 Edit menu 浮动窗

当要求用户在程序进行的同时输入多个信息时,浮动框(Popover)是个绝佳选择:

1.1.2 Segment Controls 分段控件

分段控件包含一系列分段(至少两个),可以用于筛选内容或为整理的分类内容创建标签:

1.1.3 Sliders 滑块

滑块控件可以让用户从一个允许范围内滑动滑块选择一个特定的值:

1.1.4 Stepper 进步器

一个步进器需要包含两个分段按钮,一个用于减少当前值,一个用于增加。:

1.1.5 Picker 选择器

选择器通常用作级联表达,常见的时间选择器:

1.1.6 Activity dialog 活动对话框

活动对话框用于内容(text, images, links)分享:

1.1.7 Collection View 网格视图

通常用于网格布局(九宫格,瀑布流):


Collection默认选中没有高亮

1.1.8 Toolbar 工具栏

当遇到多种操作可以考虑使用工具栏:

1.0.8 System icons 系统icon

系统图标往往有特定的意向表达,被用户熟知,适当的应用系统图标会降低app的使用难度, 提高用户体验:

2, iOS 常用配色方案

2.0.1 iOS 系统默认颜色

Name hex
groupTableViewBackgroundColor #EFEFF4
lightTextColor #FFFFFF
darkTextColor #000000
blackColor #000000
darkGrayColor #555555
lightGrayColor #AAAAAA
grayColor #7F7F7F
whiteColor #FFFFFF
redColor #FF0000
greenColor #00FF00
blueColor #0000FF
cyanColor #00FFFF
yellowColor #FFFF00
magentaColor #FF00FF
orangeColor #FF7F00
purpleColor #7F007F
brownColor #996633
clearColor #000000

2.0.2 iOS 苹果官方设计指南推荐常用颜色


2.0.3 iOS 推荐配色


3, iOS 常用系统字体

Element Size(pt) Weight Spacing(pt) Type
systemFont 14 default default Text
smallSystemFont 12 default default Text
buttonFont 18 default default Text
labelFont 17 default default Text
Nav Bar Title 17 Medium 0.5 Display
Nav Bar Button 17 Regular 0.5 Display
Search Bar 13.5 Regular 0 Text
Tab Bar Button 10 Regular 0.1 Text
Table Header 12.5 Regular 0.25 Text
Table Row 16.5 Regular 0 Text
Table Row Subtitle 12 Regular 0 Text
Table Footer 12.5 Regular 0.2 Text
Action Sheets 20 Regular / Medium 0.5 Display

https://developer.apple.com/ios/human-interface-guidelines iOS官方设计指南

http://www.ui.cn/detail/32167.html 中文

http://ivomynttinen.com/blog/ios-design-guidelines 英文

http://ms.csdn.net/geek/72062 全新Apple iOS设计规范指南

http://wiki.jikexueyuan.com/project/ios-9-human-computer-interface-guidelines/ iOS 9 人机交互指南

https://designcode.io/iosdesign-guidelines

纯代码实现UISplitViewController分屏效果

##

一、应用场景

UISplitViewController 是 iphone 6s plus,ipad系列常用的控件 在iOS8以上的iPhone中得到支持( In iOS 8 and later)一个典型的场景:iPhone 6s plus 内置的设置APP; 根据苹果设计指南,UISplitViewController一般作为更控制器来使用即rootViewController(. Split view controllers are normally installed at the root of your app’s window),不能作为navigationController的子控制器。

Xcode 7 升级问题

最近用XCode 7 也有一段时间了,每次IDE升级都会产生一系列的问题,因此,小计一下,希望朋友们在遇到这些问题时能轻松应对。
问题一:

解决办法:
bitcodea

问题二:
iOS模拟器出现一大堆UUID,特别的烦人。以下是解决这个恼人问题的方法,希望能帮到大家:

  1. 关闭Xcode 和 模拟器;
  2. $ sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
  3. $ rm -rf ~/Library/Developer/CoreSimulator/Devices
  4. 重启Xcode

问题就这么愉快的解决了。

顺便向大家推荐 Xcode 下本人使用频率较高的几款插件:

1,alcatraz
Package manager for Xcode
http://alcatraz.io
https://github.com/supermarin/Alcatraz
xcode插件管理工具
2,VVDocumenter-Xcode
3,KSImageNamed-Xcode
大家可以用alcatraz搜索自己喜欢的插件

学历是铜牌,能力是银牌,人脉是金牌,思维是王牌

有人工作,有人上学,大家千万不要错过这篇文章,能看到这篇文章也是一种幸运,真的受益匪浅,对我有很大启迪,这篇文章将会改变你我的一生,真的太好了,希望与有缘人分享,也希望对有缘人有所帮助!看完之后有种“相见恨晚”的感觉,特别激动,希望大家好好的珍藏这篇文章,相信多年以后,再来看这篇文章,一定有不同的感觉。

正如”打工皇帝”唐骏说:”我觉得有两种人不要跟别人争利益和价值回报。第一种人就是刚刚进入企业的人,头5年千万不要说你能不能多给我一点儿工资,最重要的是能在企业里学到什么,对发展是不是有利……”
人总是从平坦中获得的教益少,从磨难中获得的教益多;从平坦中获得的教益浅,从磨难中获得的教益深。一个人在年轻时经历磨难,如能正确视之,冲出黑暗,那就是一个值得敬慕的人。最要紧的是先练好内功,毕业后这5年就是练内功的最佳时期,练好内功,才有可能在未来攀得更高。
出路在哪里?出路在于思路!
  其实,没有钱、没有经验、没有阅历、没有社会关系,这些都不可怕。没有钱,可以通过辛勤劳动去赚;没有经验,可以通过实践操作去总结;没有阅历,可以一步一步去积累;没有社会关系,可以一点一点去编织。但是,没有梦想、没有思路才是最可怕的,才让人感到恐惧,很想逃避!
  人必须有一个正确的方向。无论你多么意气风发,无论你是多么足智多谋,无论你花费了多大的心血,如果没有一个明确的方向,就会过得很茫然,渐渐就丧失了斗志,忘却了最初的梦想,就会走上弯路甚至不归路,枉费了自己的聪明才智,误了自己的青春年华。
荷马史诗《奥德赛》中有一句至理名言:”没有比漫无目的地徘徊更令人无法忍受的了。”毕业后这5年里的迷茫,会造成10年后的恐慌,20年后的挣扎,甚至一辈子的平庸。如果不能在毕业这5年尽快冲出困惑、走出迷雾,我们实在是无颜面对10年后、20年后的自己。毕业这5年里,我们既有很多的不确定,也有很多的可能性。

一步一步搭建Hexo博客

个人博客快速入门

一、生成个人主页

注册一个github账号,创建一个以你用户名为前缀的仓库,例如:KingCQ.github.com,点击仓库的设置(Settings)进入里面生成 GitHubPages 成功完成相应操作后你会看到 Your site is published at http://kingcq.github.io. 打开这个网页,这就是你的pages页面了