Files
fanyin-ios/QXLive/Base/NSURLSession+QX.m

38 lines
1.3 KiB
Mathematica
Raw Normal View History

2025-08-12 14:27:12 +08:00
//
// 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