-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
NSInternalConsistencyException thrown when using CLLocationManager.requestLocation
in 3.3.0
#1136
Comments
Hi @jamiepinkham ,
I think that delegate proxy is behaving as designed now. The method is optional and if there aren't any observers registered it doesn't auto implement it. That seems reasonable to me. I seems to me that this API is exception to the rule. Implementing this method on delegate proxy should should solve this problem. It's just a matter of adding |
What'd be really nice if there was a way in which we could somehow fold those error events into the |
|
Awesome! Thanks @kzaher! |
@kzaher should we update the RxExample implementation of this delegate proxy? It's currently broken as described above. I was able to update ours to work similarly to the UIScrollView one, but the RxExample code is currently a bit misleading. |
@tomburns I for one would really appreciate that 😄 |
PRs are always welcome guys 😜 |
Short description of the issue:
Sample project demonstrating the issue can be found here
We are using a
DelegateProxy
to wrapCLLocationManagerDelegate
, found here, and have added support for callingCLLocationManager.requestLocation
to get a one time location update as you can see here. In previous versions of RxSwift, this worked as expected. However, upon updating to3.3.0
this code now crashes with anNSInternalConsistencyException
because theDelegateProxy
does not implementlocationManager:didFailWithError:
. Despite the method being declared as optional, the documentation states:A quick fix for us was to implement the
locationManager:didFailWithError:
on the delegate proxy, but I'm not sure how to forward those calls such that the reactive extension'sdidFailWithError
observable is triggered. I suspect it's similar to how it's implemented forUIScrollView
's delegate proxy.I think this is somehow related to the changes made for these issues: #1081 #1087
I don't think this is a bug per se in
RxSwift
, but a bug in my implementation of the DelegateProxy forCLLocationManager
, and is also latent in the implementation in the DelegateProxy found in the example code.Expected outcome:
The delegate proxy for
CLLocationManager
should be updated to handle thelocationManager:didFailWithError:
delegate method.We should update the examples to demonstrate the correct usage of required delegate methods in delegate proxies.
What actually happens:
Using the delegate proxy in the sample code, and calling
requestLocation
without first obtaining location permissions crashes with anNSInternalConsistencyException
RxSwift
3.3.0
Platform/Environment
How easy is to reproduce? (chances of successful reproduce after running the self contained code)
Xcode version:
Installation method:
I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)
Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)
The text was updated successfully, but these errors were encountered: