Tôi nhận được một ứng dụng sử dụng ASIHTTPRequest.iOS 5: https (ASIHTTPRequest) ngừng hoạt động
tôi biên dịch lại ứng dụng của tôi với iOS 5 (sdk: 5.0/xcode: 4.2 Build 4D199) và https kết nối thất bại với thông báo lỗi (cuộc gọi cùng với https tác phẩm khuyết tật tốt):
Error Domain=ASIHTTPRequestErrorDomain Code=1 "A connection failure occurred" UserInfo=0xa8e66e0 {NSUnderlyingError=0xa8ac6c0 "The operation couldn’t be completed. (OSStatus error -9844.)", NSLocalizedDescription=A connection failure occurred}
Với debug log được kích hoạt:
[STATUS] Starting asynchronous request <ASIFormDataRequest: 0xd96fc00>
[CONNECTION] Request <ASIFormDataRequest: 0xd96fc00> will not use a persistent connection
[STATUS] Request <ASIFormDataRequest: 0xd96fc00>: Failed
[CONNECTION] Request #(null) failed and will invalidate connection #(null)
tôi thấy bài này có liên quan: https://devforums.apple.com/message/537440#537440 có thể Expl trong vấn đề của tôi.
dựa trên ý tưởng rằng iOS 5 thích TLS 1.2, tôi cố gắng thay đổi các thiết lập kCFStreamSocketSecurityLevelTLSv1 trong AIHTTPRequest.m
NSDictionary *sslProperties = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithBool:YES],
kCFStreamSSLAllowsExpiredCertificates,
[NSNumber numberWithBool:YES], kCFStreamSSLAllowsAnyRoot,
[NSNumber numberWithBool:NO], kCFStreamSSLValidatesCertificateChain,
kCFNull,kCFStreamSSLPeerName,
kCFStreamSocketSecurityLevelTLSv1, kCFStreamSSLLevel,// my modif
nil];
không thành công. Có lẽ sửa đổi của tôi không chính xác?
chi tiết:
- tôi có ARC vô hiệu hóa
- tôi sử dụng libz.1.2.5.dylib
- tôi cập nhật các ASIHTTPRequest một tuần trước đây.
Tôi không biết vấn đề có phải là câu chuyện chứng chỉ (như phiên bản TLS) hay không.
bất kỳ trợ giúp/ý tưởng nào được hoan nghênh!
Xem thêm bản vá này: https://github.com/ignaval/asi-http-request/commit/c782abbeb204156d30ecbb902915d1eaf9b10f9e#comments - bạn muốn thêm thuộc tính vào validateCertificate = YES case cũng – ckhan
Đối với tôi, thay đổi của @ ckhan là cũng được yêu cầu trước khi nó hoạt động trên 5.0 – leontx
lực 'kCFStreamSocketSecurityLevelTLSv1_2' cũng hoạt động với phương pháp này – ReDetection