Commit ffda5a02 by lee

u timeout

parent f8f9c8a3
...@@ -166,12 +166,10 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -166,12 +166,10 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
NSURL *url = [NSURL URLWithString:self.baseUrl]; NSURL *url = [NSURL URLWithString:self.baseUrl];
AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithBaseURL:url]; AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithBaseURL:url];
//设置超时时间为10秒 //设置超时时间为10秒
[sessionManager.requestSerializer willChangeValueForKey:@"timeoutInterval"]; // [sessionManager.requestSerializer willChangeValueForKey:@"timeoutInterval"];
sessionManager.requestSerializer.timeoutInterval = 10.f; sessionManager.requestSerializer.timeoutInterval = 10.f;
[sessionManager.requestSerializer didChangeValueForKey:@"timeoutInterval"]; // [sessionManager.requestSerializer didChangeValueForKey:@"timeoutInterval"];
if (isJsonParameter) { if (isJsonParameter) {
sessionManager.requestSerializer = [AFJSONRequestSerializer serializerWithWritingOptions:0]; sessionManager.requestSerializer = [AFJSONRequestSerializer serializerWithWritingOptions:0];
...@@ -199,6 +197,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -199,6 +197,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
apiPath:(NSString *)apiPath apiPath:(NSString *)apiPath
parameters:(NSDictionary *)parameters parameters:(NSDictionary *)parameters
filePaths:(NSDictionary *)filePaths filePaths:(NSDictionary *)filePaths
timeout:(NSTimeInterval) timeout
images:(NSArray *)images images:(NSArray *)images
jsonParameter:(BOOL)isJsonParameter jsonParameter:(BOOL)isJsonParameter
result:(Class)result result:(Class)result
...@@ -219,6 +218,9 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -219,6 +218,9 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
success:success success:success
failure:failure]; failure:failure];
AFHTTPSessionManager *sessionManager = [self buildSessionManager:isJsonParameter]; AFHTTPSessionManager *sessionManager = [self buildSessionManager:isJsonParameter];
if (timeout) {
[sessionManager.requestSerializer setTimeoutInterval:timeout];
}
//app version code //app version code
// static NSString *KEY_VERSION_CODE = @"version_code"; // static NSString *KEY_VERSION_CODE = @"version_code";
// NSString *build = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]; // NSString *build = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
...@@ -323,6 +325,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -323,6 +325,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
apiPath:apiPath apiPath:apiPath
parameters:parameters parameters:parameters
filePaths:filePaths filePaths:filePaths
timeout:0
images:nil images:nil
jsonParameter:isJsonParameter jsonParameter:isJsonParameter
result:result result:result
...@@ -811,13 +814,14 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -811,13 +814,14 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
success:(void(^)(NSURLSessionDataTask *task,KWMCheckoutPayResult *result))success success:(void(^)(NSURLSessionDataTask *task,KWMCheckoutPayResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{ failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = [NSString stringWithFormat:@"https://%@/wechatpay/app/unified_order",Pay_API_DOMAIN]; NSString *apiPath = [NSString stringWithFormat:@"https://%@/wechatpay/app/unified_order",Pay_API_DOMAIN];
return [self startSessionTask:KWMHTTPMethodPOST // return [self startSessionTask:KWMHTTPMethodPOST
apiPath:apiPath // apiPath:apiPath
parameters:parameters // parameters:parameters
result:[KWMCheckoutPayResult class] // result:[KWMCheckoutPayResult class]
model:[KWMWechatPayData class] // model:[KWMWechatPayData class]
success:success // success:success
failure:failure]; // failure:failure];
return [self startSessionTask:KWMHTTPMethodPOST apiPath:apiPath parameters:parameters filePaths:nil timeout:30 images:nil jsonParameter:NO result:[KWMCheckoutPayResult class] model:[KWMWechatPayData class] success:success failure:failure];
} }
/** /**
...@@ -834,13 +838,14 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -834,13 +838,14 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
success:(void(^)(NSURLSessionDataTask *task,KWMCheckoutPayResult *result))success success:(void(^)(NSURLSessionDataTask *task,KWMCheckoutPayResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{ failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = [NSString stringWithFormat:@"https://%@/alipay/app/unified_order",Pay_API_DOMAIN]; NSString *apiPath = [NSString stringWithFormat:@"https://%@/alipay/app/unified_order",Pay_API_DOMAIN];
return [self startSessionTask:KWMHTTPMethodPOST // return [self startSessionTask:KWMHTTPMethodPOST
apiPath:apiPath // apiPath:apiPath
parameters:parameters // parameters:parameters
result:[KWMCheckoutPayResult class] // result:[KWMCheckoutPayResult class]
model:nil // model:nil
success:success // success:success
failure:failure]; // failure:failure];
return [self startSessionTask:KWMHTTPMethodPOST apiPath:apiPath parameters:parameters filePaths:nil timeout:30 images:nil jsonParameter:NO result:[KWMCheckoutPayResult class] model:nil success:success failure:failure];
} }
- (NSURLSessionDataTask *) wechatPayOrderQuery:(NSDictionary *)parameters - (NSURLSessionDataTask *) wechatPayOrderQuery:(NSDictionary *)parameters
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2017090411</string> <string>2017090512</string>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>
<false/> <false/>
<key>LSApplicationQueriesSchemes</key> <key>LSApplicationQueriesSchemes</key>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment