增加换肤功能
This commit is contained in:
37
QXLive/Base/NSURLSession+QX.m
Normal file
37
QXLive/Base/NSURLSession+QX.m
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// NSURLSession+BJX.m
|
||||
// BJXGame
|
||||
//
|
||||
// Created by apple on 2022/11/7.
|
||||
// Copyright © 2022 鑫创. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSURLSession+QX.h"
|
||||
#import <objc/runtime.h>
|
||||
|
||||
@implementation NSURLSession (QX)
|
||||
+ (void)load{
|
||||
Method method1 = class_getClassMethod([NSURLSession class],@selector(sessionWithConfiguration:));
|
||||
Method method2 = class_getClassMethod([NSURLSession class],@selector(px_sessionWithConfiguration:));
|
||||
method_exchangeImplementations(method1, method2);
|
||||
|
||||
Method method3 =class_getClassMethod([NSURLSession class],@selector(sessionWithConfiguration:delegate:delegateQueue:));
|
||||
Method method4 =class_getClassMethod([NSURLSession class],@selector(px_sessionWithConfiguration:delegate:delegateQueue:));
|
||||
method_exchangeImplementations(method3, method4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+ (NSURLSession*)px_sessionWithConfiguration:(NSURLSessionConfiguration*)configuration delegate:(nullable id)delegate delegateQueue:(nullable NSOperationQueue*)queue{
|
||||
if(configuration) configuration.connectionProxyDictionary=@{};
|
||||
return [self px_sessionWithConfiguration:configuration delegate:delegate delegateQueue:queue];
|
||||
}
|
||||
|
||||
|
||||
|
||||
+ (NSURLSession*)px_sessionWithConfiguration:(NSURLSessionConfiguration*)configuration{
|
||||
if(configuration) configuration.connectionProxyDictionary=@{};
|
||||
return [self px_sessionWithConfiguration:configuration];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user