-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
69 changed files
with
12,972 additions
and
1,976 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# RFAPI 背后的设计 | ||
|
||
好的设计应该是不会过时的 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# RFAPI v2 升级指南 | ||
|
||
> *Because there should be no non-Chinese developers using this library before, this guide is not available in English at this time.* | ||
v1 到 v2 几乎全部重写,内部变化很大,但是实际项目需要调整的地方应该不多。 | ||
|
||
如果只是用到请求发送、取消这样的基本功能,甚至无需修改。 | ||
|
||
## 主要类型变化 | ||
|
||
`RFAPI` 的父类由 `NSOperationQueue` 变为 `NSObject`。如果之前用到了 NSOperationQueue 的方法,只能都移除了。`maxConcurrentOperationCount` 可以改用 NSURLSessionConfiguration 的 `HTTPMaximumConnectionsPerHost` 属性设置。 | ||
|
||
请求方法返回的请求对象类型从 `AFHTTPRequestOperation` 变为 `RFAPITask`,暴露的属性有减少。 | ||
|
||
`RFAPIControl` 被移除,取而代之的类是 `RFAPIRequestConext`,必须修改的地方并不多: | ||
|
||
* `message` 属性更名为 `activityMessage`; | ||
* 移除的属性都没用到,`RFAPIRequestConext` 新增的属性也无需修改; | ||
* 不再支持从字典创建,这个正常用得极少。 | ||
|
||
缓存管理移除了,但这个系统只在 iOS 7 之前工作,正常的项目应该影响不到。 | ||
|
||
## Define 和 DefineManager | ||
|
||
`RFAPIDefine` 的 `responseClass` 类型由 class 改为 string,其他在外部看来没有变化。 | ||
|
||
`RFAPIDefineManager` 现在直接使用 define 对象,不再使用字典作为存储。`defaultRule` 更名为 `defaultDefine`,修改立即生效,无需再手动调用 `setNeedsUpdateDefaultRule` 方法。之前对 define 字段进行修改的方法被移除,直接对 define 对象进行修改即可。`setDefinesWithRulesInfo:` 现在支持分组。 | ||
|
||
在 DEBUG 环境(准确的说是 RFDEBUG 为真且 NSAssert 启用)下编译的 RFAPI,在 define 处理时会进行一些额外检查,帮助你正确使用,Release 环境这些检查不会执行。 | ||
|
||
## 请求创建 | ||
|
||
v1 请求有两个方法,正常请求和表单上传请求,正常请求有兼容实现,可无需修改(但是推荐改成新的方法)。 | ||
|
||
表单上传只能用新的请求方法,不再需要 `RFHTTPRequestFormData`,直接设置 request context 的 formData 即可。 | ||
|
||
## responseProcessingQueue | ||
|
||
变为 `processingQueue`,默认的队列由主线程队列变为私有的并行队列。 | ||
|
||
## Swift | ||
|
||
如果之前在 Swift 中子类了 `RFAPI`,可能需要调整方法名,需要重写的方法有了更合适的命名。 | ||
|
||
## 国际化 | ||
|
||
// todo | ||
<!-- v1 的很多错误信息是硬编码在代码中的 --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.security.app-sandbox</key> | ||
<true/> | ||
<key>com.apple.security.network.client</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Example/iOS-Swift/RFDTestEntity.m → Example/Shared/Models/RFDTestEntity.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
#import "RFDTestEntity.h" | ||
#import "RFRuntime.h" | ||
#import <RFKit/RFRuntime.h> | ||
|
||
@implementation RFDTestEntity | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.