matrix-org / matrix-org/matrix-ios-sdk
Error Domain=NSURLErrorDomain Code=-999 "cancelled"
- Dominant language
- Objective-C
- Stars
- 484
- Forks
- 225
- PR merge metrics
- No merged PRs in 30d
Description
With or without a white list of matrix.org, the latest stable SDK to run the case code is the error code -999
```
let homeServerUrl = URL(string: "http://matrix.org")!
let mxRestClient = MXRestClient(homeServer: homeServerUrl, unrecognizedCertificateHandler: nil)
mxRestClient.publicRooms(onServer: nil, limit: 100) { response in
switch response {
case .success(let rooms):
// This callback will not execute
// rooms is an array of MXPublicRoom objects containing information like room id
print("The public rooms are: \(rooms)")
case .failure: break
}
}
```
the error msg show:
```
2019-04-01 19:10:35.739403+0800 tzuchi-chat[98248:716357] [MXHTTPClient] cancel
2019-04-01 19:10:35.739575+0800 tzuchi-chat[98248:716357] [MXHTTPClient] cleanupBackgroundTask
2019-04-01 19:10:35.739773+0800 tzuchi-chat[98248:716357] [MXHTTPClient] cancel
2019-04-01 19:10:35.739812+0800 tzuchi-chat[98248:716428] [MXHTTPClient] SessionDidBecomeInvalid: <__NSURLSessionLocal: 0x7ff0c5409960>: (null)
2019-04-01 19:10:35.739874+0800 tzuchi-chat[98248:716357] [MXHTTPClient] cleanupBackgroundTask
2019-04-01 19:10:35.740039+0800 tzuchi-chat[98248:716428] [MXStrongifyAndReturnIfNil] Released reference at MXHTTPClient.m:126
2019-04-01 19:10:35.762290+0800 tzuchi-chat[98248:716428] Task <09850990-0EE3-4297-842E-4800EEFAE802>.<1> load failed with error Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=http://matrix.org/_matrix/client/r0/publicRooms, NSErrorFailingURLKey=http://matrix.org/_matrix/client/r0/publicRooms, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <09850990-0EE3-4297-842E-4800EEFAE802>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <09850990-0EE3-4297-842E-4800EEFAE802>.<1>, NSLocalizedDescription=cancelled} [-999]
2019-04-01 19:10:35.762773+0800 tzuchi-chat[98248:716428] [MXHTTPClient] SessionDidBecomeInvalid: <__NSURLSessionLocal: 0x7ff0c55172f0>: (null)
2019-04-01 19:10:35.762901+0800 tzuchi-chat[98248:716428] [MXStrongifyAndReturnIfNil] Released reference at MXHTTPClient.m:126
2019-04-01 19:10:35.763188+0800 tzuchi-chat[98248:716423] Task <09850990-0EE3-4297-842E-4800EEFAE802>.<1> finished with error - code: -999
2019-04-01 19:10:35.765240+0800 tzuchi-chat[98248:716357] [MXHTTPClient] Request 0x600002d3ba80 failed for path: _matrix/client/r0/publicRooms - HTTP code: 0. Error: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=http://matrix.org/_matrix/client/r0/publicRooms, NSErrorFailingURLKey=http://matrix.org/_matrix/client/r0/publicRooms, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <09850990-0EE3-4297-842E-4800EEFAE802>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <09850990-0EE3-4297-842E-4800EEFAE802>.<1>, NSLocalizedDescription=cancelled}
2019-04-01 19:10:35.765380+0800 tzuchi-chat[98248:716357] [MXStrongifyAndReturnIfNil] Released reference at MXHTTPClient.m:237
```
```
NSAppTransportSecurity
NSExceptionDomains
matrix.org
NSExceptionRequiresForwardSecrecy
NSExceptionAllowsInsecureHTTPLoads
cas.openmarket.com
NSExceptionAllowsInsecureHTTPLoads
NSExceptionRequiresForwardSecrecy
NSAllowsArbitraryLoads
```
### How should I do?
Contributor guide
Research direction
Start at the publicRooms call and inspect MXHTTPClient.m around the logged cleanupBackgroundTask and released-reference locations at lines 126 and 237. Reproduce the request with the supplied URL and logs, then determine why the session or task is cancelled; done means the callback completes without the reported -999 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, objective-c
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100