Multi-language configuration and delete configuration
There should be a picture here
Delete the configuration: Select the Chinese-English translation file and deselect it on the right side of Xcode
When it comes to private images, SD_webImage is required to request images with tokens. This setting is usually set where the new token is returned
-(void)setNewToken:(NSURLSessionDataTask *)task{
NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response;
if (response.statusCode==401) {
//todo
}
NSDictionary *allHeaders = response.allHeaderFields; NSLog(@"allHeaders:%@",allHeaders);
if ([self dictionary:allHeaders ContainsObject:@"Authorization"]) {
NSString *header = [allHeaders valueForKey:@"Authorization"];
header = [header stringByReplacingOccurrencesOfString:@"XXXXX" withString:@""];
header = [header stringByReplacingOccurrencesOfString:@"" withString:@""];
if (header.length>0) {
[[NSUserDefaults standardUserDefaults] setObject:header forKey:userTokenSaveInDefaultKey]; }}}Copy the code
-(void)initHttpSessionManager { _httpSessionManager = [[AFHTTPSessionManager manager] initWithBaseURL:[NSURL URLWithString:self.currentHost]]; / / -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- configuration version number [_httpSessionManager requestSerializersetValue:@"XX/XX.XXXXX.v1+json" forHTTPHeaderField:@"accept"]; / / -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- configuration token nsstrings * userToken = [[NSUserDefaults standardUserDefaults] objectForKey:userTokenSaveInDefaultKey]; [_httpSessionManager.requestSerializersetValue:[NSString stringWithFormat:@"XXXXX %@",userToken] forHTTPHeaderField:@"Authorization"]; / / -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- sd_webImage with token request SDWebImageDownloader * sd = [SDWebImageManager sharedManager].imageDownloader; [sdsetValue:[NSString stringWithFormat:@"XXXXX %@",userToken] forHTTPHeaderField:@"Authorization"];
//----------------------------
[_httpSessionManager.requestSerializer setValue: @"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
_httpSessionManager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:
@"application/json"The @"text/json"The @"text/plain"The @"text/html"The @"text/javascript", nil]; / / configure HTTPS / / _httpSessionManager securityPolicy = [self customSecurityPolicy]; // AFSecurityPolicy *securityPolicy = [[AFSecurityPolicy alloc] init]; // [securityPolicysetAllowInvalidCertificates:YES]; // _httpSessionManager.securityPolicy = securityPolicy; // _httpSessionManager.securityPolicy.allowInvalidCertificates = YES; / / set the timeout [_httpSessionManager requestSerializer willChangeValueForKey: @"timeoutInterval"];
_httpSessionManager.requestSerializer.timeoutInterval = self.defaultSeconds;
[_httpSessionManager.requestSerializer didChangeValueForKey:@"timeoutInterval"];
}
Copy the code
Focus on
/ / -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- configuration token nsstrings * userToken = [[NSUserDefaults standardUserDefaults] objectForKey:userTokenSaveInDefaultKey]; [_httpSessionManager.requestSerializersetValue:[NSString stringWithFormat:@"XXXX %@",userToken] forHTTPHeaderField:@"Authorization"]; SDWebImageDownloader *sd = [SDWebImageManager sharedManager]. ImageDownloader; [sdsetValue:[NSString stringWithFormat:@"XXXXXX %@",userToken] forHTTPHeaderField:@"Authorization"];
//----------------------------
Copy the code
Submit XMNetworking as a formconfig.generalHeaders = @{@"Content-Type": @"application/x-www-form-urlencoded"};
[XMCenter setupConfig:^(XMConfig *config) {
config.generalServer = SZURL_BASE_DEV;
//config.generalHeaders = @{@"Content-Type": @"text/html; charset=utf-8"};
//config.generalParameters = @{@"general-parameter": @"general parameter value"};
config.generalHeaders = @{@"Content-Type": @"application/x-www-form-urlencoded"};
config.generalUserInfo = nil;
config.callbackQueue = dispatch_get_main_queue();
config.engine = [XMEngine sharedEngine];
#ifdef DEBUG
config.consoleLog = YES;
#endif
}];
Copy the code
And download some other files
-(void)downLoadImageWithParms:(NSDictionary *)parms Success:(void (^)(id responseObject) )SuccessBlock Failure:(void (^)(NSError * _Nonnull error))failureBlock{
NSString *url = parms[@"url"];
if (url.length==0) return; [XMCenter sendRequest:^(XMRequest *request) { request.url = url; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory=[paths objectAtIndex:0]; request.downloadSavePath = [NSHomeDirectory() stringByAppendingString:@"/Documents/"];
request.requestType = kXMRequestDownload;
NSString *userToken = [[NSUserDefaults standardUserDefaults] objectForKey:userTokenSaveInDefaultKey];
request.headers=@{@"Content-Type": @"application/x-www-form-urlencoded"The @"Authorization":[NSString stringWithFormat:@"XXXXXX %@",userToken]};
} onProgress:^(NSProgress *progress) {
// the progress block is running on the session queue.
if (progress) {
NSLog(@"onProgress: %f", progress.fractionCompleted);
}
} onSuccess:^(id responseObject) {
NSLog(@"onSuccess: %@", responseObject);
if (SuccessBlock) {
SuccessBlock(responseObject);
}
} onFailure:^(NSError *error) {
NSLog(@"onFailure: %@", error);
failureBlock(error);
}];
}
Copy the code
Error executing pod Install
➜ opf - ios - rider pod install/Library/Ruby/Gems / 2.3.0 / Gems/cocoapods - 1.5.3 / lib/cocoapods/command. The rb: 118:in `git_version': Failed to extract git version from `git --version` ("xcrun: error: active developer path (\"/Applications/Xcode.app/Contents/Developer\") does not exist\nUse `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.\nSee `man xcode-select` for more Details. \ n ") (RuntimeError) from/Library/Ruby/Gems / 2.3.0 / Gems/cocoapods - 1.5.3 / lib/cocoapods/command. The rb: 130: in `verify_minimum_git_version! 'The from/Library/Ruby/Gems / 2.3.0 / Gems/cocoapods - 1.5.3 / lib/cocoapods/command. The rb: 49:in `run'the from/Library/Ruby/Gems / 2.3.0 / Gems/cocoapods - 1.5.3 / bin/pod: 55: in ` < top (required) >'
from /usr/local/bin/pod:22:in `load' from /usr/local/bin/pod:22:in `
'
Copy the code
Uninstall XCodeProJ and Cocoapods and install them again
sudo gem uninstall xcodeproj sudo gem uninstall cocoapods sudo gem install xcodeproj sudo gem install cocoapods sudo gem update --systemCopy the code
ERROR: While executing gem ... (Errno: : EPERM) Operation not permitted @ rb_sysopen - / System/Library/Frameworks/Ruby framework Versions / 2.3 / usr/bin/gemCopy the code
➜ ~ sudo gem install Cocoapods ERROR: While executing gem... (Gem::FilePermissionError) You don't have write permissions for the /usr/bin directory. ➜ ~ sudo gem install -n /usr/local/bin cocoapods Successfully Installed Cocoapods-1.7.0 Parsing for Cocoapods-1.7.0 Done installing documentation for Cocoapods after 3 Seconds 1 gem installed ➜ ~Copy the code
xcode-select: note: install requested for command line developer tools
Copy the code
However, after a bunch of operations, the goose found the reason: Sudo xcode-select –switch /Applications/ xcode. app to specify Xcode. Recall that the simulator could not be opened in the new Xcode. Blah blah blah…
Swift OC mixed error reported
Showing Recent Messages
ld: warning: Could not find auto-linked library 'swiftCoreFoundation'
Showing Recent Messages
ld: warning: Could not find auto-linked library 'swiftObjectiveC'
Showing Recent Messages
ld: warning: Could not find auto-linked library 'swiftQuartzCore'
Showing Recent Messages
ld: warning: Could not find auto-linked library 'swiftCore'And so onCopy the code
When a pure OC project calls the SWIFT library, the project must have a SWIFT file, even if you don’t use it.
A very abnormal state: it was delayed for 3s after the home page of the APP was displayed for the first time
================================================================= Main Thread Checker: UI API called on a background thread: -[UIApplication delegate] PID: 5123, TID: 461328, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0 Backtrace: 4 OFRider 0x00000001009cc968 -[OFRWaitOrderController refresh] + 1396 5 CoreFoundation 0x00000001848415bc <redacted> + 20 6 CoreFoundation 0x0000000184841588 <redacted> + 64 7 CoreFoundation 0x0000000184840a7c <redacted> + 392 8 CoreFoundation 0x0000000184840728 <redacted> + 96 9 CoreFoundation 0x00000001847ba524 <redacted> + 1496 10 CoreFoundation 0x00000001848401d8 _CFXNotificationPost + 696 11 Foundation 0x0000000185228814 <redacted> + 68 12 OFRider 0x000000010072fa9c __46-[OFRHomeController postWaitOrderNotification]_block_invoke + 108 13 libdispatch.dylib 0x0000000102aa0c74 _dispatch_client_callout + 16 14 libdispatch.dylib 0x0000000102aa3ffc _dispatch_continuation_pop + 524 15 libdispatch.dylib 0x0000000102ab6610 _dispatch_source_invoke + 1444 16 libdispatch.dylib 0x0000000102aa3928 _dispatch_queue_override_invoke + 448 17 libdispatch.dylib 0x0000000102ab1dc8 _dispatch_root_queue_drain + 372 18 libdispatch.dylib 0x0000000102ab27ac _dispatch_worker_thread2 + 156 19 libsystem_pthread.dylib 0x00000001844f11b4 _pthread_wqthread + 464 20 libsystem_pthread.dylib 0x00000001844f3cd4 start_wqthread + 4 2019-05-29 10:36:33.922136+0800 OFRider[5123:461328] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication delegate] PID: 5123, TID: 461328, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0 Backtrace: 4 OFRider 0x00000001009cc968 -[OFRWaitOrderController refresh] + 1396 5 CoreFoundation 0x00000001848415bc <redacted> + 20 6 CoreFoundation 0x0000000184841588 <redacted> + 64 7 CoreFoundation 0x0000000184840a7c <redacted> + 392 8 CoreFoundation 0x0000000184840728 <redacted> + 96 9 CoreFoundation 0x00000001847ba524 <redacted> + 1496 10 CoreFoundation 0x00000001848401d8 _CFXNotificationPost + 696 11 Foundation 0x0000000185228814 <redacted> + 68 12 OFRider 0x000000010072fa9c __46-[OFRHomeController postWaitOrderNotification]_block_invoke + 108 13 libdispatch.dylib 0x0000000102aa0c74 _dispatch_client_callout + 16 14 libdispatch.dylib 0x0000000102aa3ffc _dispatch_continuation_pop + 524 15 libdispatch.dylib 0x0000000102ab6610 _dispatch_source_invoke + 1444 16 libdispatch.dylib 0x0000000102aa3928 _dispatch_queue_override_invoke + 448 17 libdispatch.dylib 0x0000000102ab1dc8 _dispatch_root_queue_drain + 372 18 libdispatch.dylib 0x0000000102ab27ac _dispatch_worker_thread2 + 156 19 libsystem_pthread.dylib 0x00000001844f11b4 _pthread_wqthread + 464 20 libsystem_pthread.dylib 0x00000001844f3cd4 start_wqthread + 4
Copy the code
The key information
Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]
PID: 5123, TID: 461328, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
Copy the code
As well as
2019-05-29 10:36:33.922136+0800 OFRider[5123:461328] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]
PID: 5123, TID: 461328, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
Copy the code
Main Thread Checker
A [BoringSSL] nw_PROTOCOL_BoringSSL_error (1584) error occurred during the first app installation.
[1291:154097] [BoringSSL] nw_Protocol_BoringSSL_Error (1584) [0x135EC0030] Lower Protocol Stack Error: 54 2019-04-22 14:15:07.986618+0800 OFStore[1291:154097] TIC TCP Conn Failed [1:0x281366b80]: Err(54) 2019-04-22 14:15:07.992404+0800 OFStore[1291:154097] Task < 745fcc9A-D561-4220-8618-a9b38170e12e >.<1> HTTP load failed (error code: -1005 [1:54]) 2019-04-22 14:15:07.992664+0800 OFStore[1291:154097] Task < 745fcc9A-d561-4120-8618-a9b38170e12e >.<1> finished with error - code: -1005 2019-04-22 14:15:08.290688+0800 OFStore[1291:154087] [Fabric] Failed to Download Settings Error Domain=FABNetworkError Code=-5"(null)" UserInfo={status_code=403, type=2, request_id=70c4645204c8a4c7180ce6ebebbb55c8, content_type=application/json; Charset = utF-8} 2019-04-22 14:15:09.503203+0800 OFStore[1291:154097] [BoringSSL] nw_Protocol_BoringSSL_error (1584) [0x135E80590] Lower protocol Stack Error: 503778+0800 OFStore[1291:154097] TIC TCP Conn Failed [3:0x28136CE40]: Err(54) 2019-04-22 14:15:09.508035+0800 OFStore[1291:154097] Task < 2D1270F2-458C-4C85-935B-04e5FA4788f7 >.<1> HTTP load failed (error code: -1005 [1:54]) 2019-04-22 14:15:09.508296+0800 OFStore[1291:154097] Task < 2d1270F2-458C-4c85-935b-04e5FA4788f7 >.<1> finished with error - code: [1291:154048] [BoringSSL] nw_PROTOCOL_BORingSSL_get_output_frames (1301) [0x135e85a30] Get output frames failed, State 8196 2019-04-22 14:17:07.331847+0800 OFStore[1291:154048] [BoringSSL] Nw_protocol_boringssl_get_output_frames (1301) [0x135e85a30] Get output frames failed, State 8196 2019-04-22 14:17:07.332264+0800 OFStore[1291:154048] TIC Read Status [6:0x0]: 1:57 2019-04-22 14:17:07.332294+0800 OFStore[1291:154048] TIC Read Status [6:0x0]: 1:57 2019-04-22 14:18:55.325783+0800 OFStore[1291:154048] XPC connection interruptedCopy the code
The first response to the request is that there may be a background interface problem, which is eventually resolved on the app side.
- Reasons involved: When the app started and loaded the root controller, some problems were triggered by the creation. I failed to locate the specific reasons by checking the thread tree and the breakpoint.
- Solution: Change the first startup to no network request, and make the login page as the root controller (I used to make the home page as the root controller before the change, and then pop up the login page according to the conditions).
OC -> Swift message type mismatch.
Thread 1: Fatal error: NSArray element failed to match the Swift Array Element type
Copy the code