Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bawn committed Feb 24, 2016
1 parent 62ad3fc commit 6f725dc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion LCNetwork.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "LCNetwork"
s.version = "1.1.4"
s.version = "1.1.5"
s.summary = "基于AFNetworking的网络库封装"
s.homepage = "https://github.com/bawn/LCNetwork"
s.license = 'MIT'
Expand Down
6 changes: 3 additions & 3 deletions LCNetwork/LCBaseRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ typedef NS_ENUM(NSInteger , LCRequestSerializerType) {
- (BOOL)ignoreUnifiedResponseProcess;

/**
* 返回完全自定义的接口地址
* 是否使用自定义的接口地址,也就是不会使用 mainBaseUrl 或 viceBaseUrl,这时候在 apiMethodName 就可以是用自定义的接口地址了
*
* @return 完全自定义的接口地址
* @return 是否使用自定义的接口地址
*/
- (NSString *)customApiMethodName;
- (BOOL)useCustomApiMethodName;

/**
* 服务端数据接收类型,比如 LCRequestSerializerTypeJSON 用于 post json 数据
Expand Down
43 changes: 21 additions & 22 deletions LCNetwork/LCBaseRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,33 +111,32 @@ - (id)rawJSONObject{
}

- (NSString *)urlString{
if ([self.child respondsToSelector:@selector(customApiMethodName)]) {
return [self.child customApiMethodName];
NSString *baseUrl = nil;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if ( [self.child respondsToSelector:@selector(isViceUrl)] && [self.child isViceUrl]) {
baseUrl = self.config.viceBaseUrl;
}
else{
NSString *baseUrl = nil;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if ( [self.child respondsToSelector:@selector(isViceUrl)] && [self.child isViceUrl]) {
baseUrl = self.config.viceBaseUrl;
}
#pragma clang diagnostic pop
#pragma clang diagnostic pop

if ([self.child respondsToSelector:@selector(useViceUrl)] && [self.child useViceUrl]){
baseUrl = self.config.viceBaseUrl;
}
else{
baseUrl = self.config.mainBaseUrl;
if ([self.child respondsToSelector:@selector(useViceUrl)] && [self.child useViceUrl]){
baseUrl = self.config.viceBaseUrl;
}
else{
baseUrl = self.config.mainBaseUrl;
}
if (baseUrl) {
if ( [self.child respondsToSelector:@selector(useCustomApiMethodName)] && [self.child useCustomApiMethodName]) {
return [self.child apiMethodName];
}
if (baseUrl) {
NSString *urlString = [baseUrl stringByAppendingString:[self.child apiMethodName]];
if (self.queryArgument && [self.queryArgument isKindOfClass:[NSDictionary class]]) {
return [urlString stringByAppendingString:[self urlStringForQuery]];
}
return urlString;
NSString *urlString = [baseUrl stringByAppendingString:[self.child apiMethodName]];
if (self.queryArgument && [self.queryArgument isKindOfClass:[NSDictionary class]]) {
return [urlString stringByAppendingString:[self urlStringForQuery]];
}
return [self.child apiMethodName];
return urlString;
}
return [self.child apiMethodName];

}
- (id)cacheJson{
if (_cacheJson) {
Expand Down
1 change: 1 addition & 0 deletions LCNetworkDemo/LCNetworkDemo/Api2.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ - (instancetype)initWith:(NSString *)lat lng:(NSString *)lng{
// };
//}


- (BOOL)cacheResponse{
return YES;
}
Expand Down

0 comments on commit 6f725dc

Please sign in to comment.