Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when accessing URLSessionDataTask #74

Open
Nonouf opened this issue Jun 14, 2017 · 3 comments
Open

Crash when accessing URLSessionDataTask #74

Nonouf opened this issue Jun 14, 2017 · 3 comments

Comments

@Nonouf
Copy link

Nonouf commented Jun 14, 2017

I'm currently testing purposely a failure on a request and when accessing the request on the URLSessionDataTask, it results in a unrecognized selector sent.

Step to reproduce:

  • Do a request that will expect to fail
  • Try to access task.currentRequest
  • Your test suite will crash with -[Vinyl.URLSessionDataTask currentRequest]: unrecognized selector sent to instance 0x608000058f90

I haven't looked deeply in the problem, but my first thought was that it is really odd as Vinyl.URLSessionDataTask is a subclass of Foundation.URLSessionDataTask and so it shouldn't be a problem to access currentRequest. Any thought on that?

@jane-austin
Copy link

Hi @Nonouf do you have a failed canned response? Thank you.

@Nonouf
Copy link
Author

Nonouf commented Oct 13, 2017

HI @jane-austin.

Sorry, this is quite old now and I changed company since so I don't even have this code anymore. From my description, I think you'd be able to reproduce it quite easily. If you can't, feel free to close the issue.

@sreekanth-ch
Copy link

sreekanth-ch commented Sep 12, 2019

@dmcrodrigues @Kastet @
Same issue is still reproducible. Any response is greatly appreciated.

'2019-09-11 21:44:57.844374-0500 weatherForecastApp[35561:4074155] -[Vinyl.URLSessionDataTask originalRequest]: unrecognized selector sent to instance 0x60400024af20
2019-09-11 21:44:57.850231-0500 weatherForecastApp[35561:4074155] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Vinyl.URLSessionDataTask originalRequest]: unrecognized selector sent to instance 0x60400024af20'
*** First throw call stack:
(
0 CoreFoundation 0x0000000107bc01cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010444ef41 objc_exception_throw + 48
2 CoreFoundation 0x0000000107c40914 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x0000000107b43178 forwarding + 1432
4 CoreFoundation 0x0000000107b42b58 _CF_forwarding_prep_0 + 120
5 weatherForecastApp 0x0000000103adbab8 $s18weatherForecastApp14ViewControllerC16fetchTemperatureyyypSgF + 1720
6 weatherForecastApp 0x0000000103adc05b $s18weatherForecastApp14ViewControllerC16fetchTemperatureyyypSgFTo + 171
7 UIKit 0x0000000104e6dec9 -[UIApplication sendAction:to:from:forEvent:] + 83
8 UIKit 0x0000000104feb1f6 -[UIControl sendAction:to:forEvent:] + 67
9 UIKit 0x0000000104feb513 -[UIControl _sendActionsForEvents:withEvent:] + 450
10 UIKit 0x0000000104fea440 -[UIControl touchesEnded:withEvent:] + 618
11 UIKit 0x0000000104ee3b1b -[UIWindow _sendTouchesForEvent:] + 2807
12 UIKit 0x0000000104ee523e -[UIWindow sendEvent:] + 4124
13 UIKit 0x0000000104e88d96 -[UIApplication sendEvent:] + 352
14 UIKit 0x00000001057cafce __dispatchPreprocessedEventFromEventQueue + 2809
15 UIKit 0x00000001057cdc23 __handleEventQueueInternal + 5957
16 CoreFoundation 0x0000000107b632b1 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
17 CoreFoundation 0x0000000107c02d31 __CFRunLoopDoSource0 + 81
18 CoreFoundation 0x0000000107b47c19 __CFRunLoopDoSources0 + 185
19 CoreFoundation 0x0000000107b471ff __CFRunLoopRun + 1279
20 CoreFoundation 0x0000000107b46a89 CFRunLoopRunSpecific + 409
21 GraphicsServices 0x000000010c1e09c6 GSEventRunModal + 62
22 UIKit 0x0000000104e6c23c UIApplicationMain + 159
23 weatherForecastApp 0x0000000103aded3b main + 75
24 libdyld.dylib 0x00000001093a0d81 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException'

This happens when I call any method from its super class (URLSessionTask)
Example-
let task = turntable.dataTask(with: url!, completionHandler: displayTemperature)
task.resume()
task.originalRequest

Calling either currentRequest or originalRequest or any super class member results in a crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants