我开发了一个使用kerberos进行身份验证的企业iOS应用程序。我对每个请求都有一个timeoutInterval = 30
。
如果用户输入密码并在请求超时之前通过密码验证,则身份验证和URL请求可以正常工作。
如果用户在超时后(iOS提示用户后30秒)输入密码,则CFNetwork会在下次该应用程序调用Web服务时崩溃应用程序,如下所示。
我不确定导致问题的原因。
Date/Time: 2017-01-24T03:16:42Z
Launch Time: 2017-01-24T03:16:03Z
OS Version: iPhone OS 10.0.2 (14A456)
Report Version: 104
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x68
Crashed Thread: 4
Thread 0:
0 libsystem_kernel.dylib 0x0000000189d8816c mach_msg_trap + 8
1 CoreFoundation 0x000000018ad85cec __CFRunLoopServiceMachPort + 188
2 CoreFoundation 0x000000018ad83908 __CFRunLoopRun + 1128
3 CoreFoundation 0x000000018acb2048 CFRunLoopRunSpecific + 440
4 GraphicsServices 0x000000018c735198 GSEventRunModal + 176
5 UIKit 0x0000000190c85628 -[UIApplication _run] + 680
6 UIKit 0x0000000190c80360 UIApplicationMain + 204
7 SampleiOSApp 0x00000001000301bc main (AppDelegate.swift:15)
8 libdyld.dylib 0x0000000189c945b8 start + 0
Thread 1:
0 libsystem_kernel.dylib 0x0000000189da6a88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000189e68db4 start_wqthread + 0
Thread 2:
0 libsystem_kernel.dylib 0x0000000189da6a88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000189e68db4 start_wqthread + 0
Thread 3:
0 libsystem_kernel.dylib 0x0000000189d8816c mach_msg_trap + 8
1 CoreFoundation 0x000000018ad85cec __CFRunLoopServiceMachPort + 188
2 CoreFoundation 0x000000018ad83908 __CFRunLoopRun + 1128
3 CoreFoundation 0x000000018acb2048 CFRunLoopRunSpecific + 440
4 Foundation 0x000000018b7c0b1c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 300
5 Foundation 0x000000018b7e160c -[NSRunLoop(NSRunLoop) runUntilDate:] + 92
6 UIKit 0x00000001915fac7c -[UIEventFetcher threadMain] + 132
7 Foundation 0x000000018b8be50c __NSThread__start__ + 1020
8 libsystem_pthread.dylib 0x0000000189e6b860 _pthread_body + 236
9 libsystem_pthread.dylib 0x0000000189e6b770 _pthread_start + 280
10 libsystem_pthread.dylib 0x0000000189e68dbc thread_start + 0
Thread 4 Crashed:
0 CFNetwork 0x000000018b51ae60 std::__1::__hash_const_iterator<std::__1::__hash_node<std::__1::__hash_value_type<AuthenticationState::AuthInfoType, std::__1::unique_ptr<AuthenticationInfo, std::__1::default_delete<AuthenticationInfo> > >, void*>*> std::__1::__hash_table<std::__1::__hash_value_type<AuthenticationState::AuthInfoType, std::__1::unique_ptr<AuthenticationInfo, std::__1::default_delete<AuthenticationInfo> > >, std::__1::__unordered_map_hasher<AuthenticationState::AuthInfoType, std::__1::__hash_value_type<AuthenticationState::AuthInfoType, std::__1::unique_ptr<AuthenticationInfo, std::__1::default_delete<AuthenticationInfo> > >, AuthenticationState::AuthInfoTypeHasher, true>, std::__1::__unordered_map_equal<AuthenticationState::AuthInfoType, std::__1::__hash_value_type<AuthenticationState::AuthInfoType, std::__1::unique_ptr<AuthenticationInfo, std::__1::default_delete<AuthenticationInfo> > >, std::__1::equal_to<AuthenticationState::AuthInfoType>, true>, std::__1::allocator<std::__1::__hash_value_type<AuthenticationState::AuthInfoType, std::__1::unique_ptr<AuthenticationInfo, std::__1::default_delete<AuthenticationInfo> > > > >::find<AuthenticationState::AuthInfoType>(AuthenticationState::AuthInfoType const&) const + 0
1 CFNetwork 0x000000018b516b90 AuthenticationState::updateState(HTTPResponseMessage*, _CFURLAuthChallenge*, _CFURLCredential const*, __SecTrust*) + 148
2 CFNetwork 0x000000018b4f8724 HTTPProtocol::_protocolInterface_useCredential(_CFURLCredential const*, _CFURLAuthChallenge*) + 880
3 CFNetwork 0x000000018b4f7008 ___ZN12HTTPProtocol19askAccountsForCredsEh_block_invoke_2 + 240
4 libdispatch.dylib 0x0000000189c611c0 _dispatch_client_callout + 12
5 libdispatch.dylib 0x0000000189c6cb24 _dispatch_block_invoke_direct + 372
6 CFNetwork 0x000000018b5f2e98 RunloopBlockContext::_invoke_block(void const*, void*) + 32
7 CoreFoundation 0x000000018acb19a8 CFArrayApplyFunction + 64
8 CFNetwork 0x000000018b5f2d7c RunloopBlockContext::perform() + 132
9 CFNetwork 0x000000018b5f40a4 MultiplexerSource::perform() + 308
10 CFNetwork 0x000000018b5f3e10 MultiplexerSource::_perform(void*) + 60
11 CoreFoundation 0x000000018ad86278 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 20
12 CoreFoundation 0x000000018ad85bc0 __CFRunLoopDoSources0 + 520
13 CoreFoundation 0x000000018ad837c0 __CFRunLoopRun + 800
14 CoreFoundation 0x000000018acb2048 CFRunLoopRunSpecific + 440
15 CFNetwork 0x000000018b49fcec +[NSURLConnection(Loader) _resourceLoadLoop:] + 332
16 Foundation 0x000000018b8be50c __NSThread__start__ + 1020
17 libsystem_pthread.dylib 0x0000000189e6b860 _pthread_body + 236
18 libsystem_pthread.dylib 0x0000000189e6b770 _pthread_start + 280
19 libsystem_pthread.dylib 0x0000000189e68dbc thread_start + 0
我的请求代码如下:
let manager = Alamofire.SessionManager.default
manager.retrier = RetryingManager()
let request: Alamofire.Request = manager.request(httpRequest as! URLRequestConvertible)
.validate(statusCode: 200..<300)
.validate(contentType: ["application/json"])
.responseObject(queue: queue, completionHandler: {
(response: DataResponse<T>) in
if let JSON = response.result.value {
DispatchQueue.main.async {
debugPrint("JSON: \(JSON)")
// callback with the data
completion(JSON, nil)
}
} else if let resultError = response.result.error {
let errorMessage = WebServerErrorHelper.createErrorMessage(resultError: resultError, statusCode: response.response?.statusCode, serverData: response.data)
DispatchQueue.main.async {
completion(nil, errorMessage)
}
}
})
此处queue
是并发DispatchQueue
,timeInterval
设置为30 httpRequest
。
我不知道如何解决问题。提前谢谢。
答案 0 :(得分:0)
这是CFNetwork
中的一个错误,已在iOS 10.3.3