Files
my_yuyin/QXLive/Base/NSURLSession+QX.m
2025-09-22 18:48:29 +08:00

38 lines
1.3 KiB
Objective-C

//
// 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