This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler | |
{ | |
NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengeUseCredential; | |
NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; | |
if (completionHandler) | |
{ | |
completionHandler(disposition, credential); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] delegate:self delegateQueue:[NSOperationQueue mainQueue]]; | |
// <NSURLSessionTaskDelegate> | |
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler | |
{ | |
completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (void)dataTaskFromRequest:(NSURLRequest *)aRequest fileName:(NSString *)aFileName | |
{ | |
NSURLSessionConfiguration *sSessionConfiguration = [NSURLSessionConfiguration defaultSessionConfiguration]; | |
NSURLSession *sSession = [NSURLSession sessionWithConfiguration:sSessionConfiguration]; | |
NSURLSessionDataTask *sPostDataTask = [sSession dataTaskWithRequest:aRequest | |
completionHandler:^(NSData *aData, NSURLResponse *aResponse, NSError *aError) { | |
if (!aError) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark - WKNavigationDelegate | |
- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler | |
{ | |
BOOL sIsFileDownload = NO; | |
NSURL *sURL = navigationResponse.response.URL; | |
NSString *sMIMEType = navigationResponse.response.MIMEType; | |
NSString *sFileName = navigationResponse.response.suggestedFilename; | |
NSDictionary *sHeaders = ((NSHTTPURLResponse *)navigationResponse.response).allHeaderFields; | |
NSString *sContentDisposition = sHeaders[@"Content-Disposition"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setupCustomUserAgent | |
{ | |
[self.webView evaluateJavaScript:@"navigator.userAgent" completionHandler:^(NSString *aUserAgent, NSError *aError) { | |
NSString *sCustomUserAgent = @"additional custom user-agent"; | |
if (aUserAgent.length > 0 && aError == nil) { | |
sCustomUserAgent = [NSString stringWithFormat:@"%@ %@", aUserAgent, sCustomUserAgent]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <CoreTelephony/CTTelephonyNetworkInfo.h> | |
#import <CoreTelephony/CTCarrier.h> | |
... | |
if (@available(iOS 12.0, *)) { | |
NSDictionary<NSString *, CTCarrier *> *dicCarrier = [[CTTelephonyNetworkInfo new] serviceSubscriberCellularProviders]; | |
for (id key in dicCarrier) { | |
NSLog(@"key: %@, carrierName: %@", key, [[dicCarrier objectForKey:key] carrierName]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PROJECT_PATH='PROJECT_PATH' | |
XCODE_PROJECT_FILE_PATH='XCODE_PROJECT_FILE_PATH.xcodeproj/XCODE_PROJECT_FILE_PATH.pbxproj' | |
JENKINS_SERVER='JENKINS_SERVER' | |
function string_replace { | |
string=$1 | |
old_string=$(echo $2 | sed 's#/#\\/#g') | |
new_string=$(echo $3 | sed 's#/#\\/#g') |
OlderNewer