You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Internal private APIs are now marked as "direct" in iOS 14 #1357
Meaning that most synchronization points, where Earl Grey (and other projects) swizzles so it can monitor the system state, are no longer available for discovery using the ObjC runtime system (reflection), and can no longer be swizzled because the underlying functions are statically called inside the system.
I wanted to start this discussion as early as now, because this will create major issues for this project and should be looked at now.
Reacted by Rotem Meidan, Vyacheslav Frolov, Copypeng and artyom-razinov
Thanks a lot for filing this @LeoNatan. I'm doing an audit to find out what methods are no longer supported for Swizzling. Till now I've only had reports of some UITouch methods failing.
Sorry for the delay here as I was testing this out more.
For recordFailure, the fix is present here - #1377
Will send the UITouch fix tomorrow.
We haven't seen any of our swizzling code fail till now, so the private API's we are using seem to be fine with the current beta. However, we would want to move away from the more private classes such as __NSCFLocalDataTask in the future.
In our Detox Sync, we went even more all-in on the __NSCFLocalDataTask tracking because it was more accurate to track network like that. 😣
So far, that API has not been hidden, but some other stuff in the network classes was hidden.
Yes, the current swizzling code seems fine, though if you have any other alternatives in Detox, I'll be really happy to take a look.
BTW, UITouch fixes are here - #1378. @steipete - our solution is a bit different from the code you shared. We are obtaining the struct for the UITouchFlags and then changing the _setIsFirstTouchToView to YES.
Probably a good idea to go over the internal API headers available in EG and see which is relevant and which isn't, to prevent usage of hidden API by people in the future.
@xavierjurado we do not plan to add it or support EarlGrey 1.0 going forward. If you sent a PR, we could take a look at it, but it won't be vetted out from our side.
@LeoNatan Yes, I have a doc I'm working on about the private API's that we use. Some of the chief ones causing concern are the data tracking classes we use - __NSCFLocalDataTask. Happy to get any suggestions from your side on how to track network requests without it.
@ThreeFingerCoder - That code is pushed to the Github Repo here. Where are you building the code from?
@tirodkar We too are swizzling __NSCFLocalDataTask methods, but mostly public ones, such as resume and suspend. We're also swizzling connection:didFinishLoadingWithError:, which is also "public" because it's called by another class (and also I think comes from a protocol), and I don't think their direct implementation survives this barrier. So for now, it's safe.
I took a slightly different approach to swizzling the user's delegate. I subclass the user's class dynamically so that we avoid the issues with analytic and crash handling frameworks (this is a historic issue we had with Earl Grey, which we solved in a PR but there is still potential for issues).
In another project, used for profiling applications, which I haven't yet looked to "modernize" for iOS 14, I have more private stuff swizzled for __NSCFLocalDataTask which I need to consider how to sidestep.
Activity
tirodkar commentedon Jun 23, 2020
Thanks a lot for filing this @LeoNatan. I'm doing an audit to find out what methods are no longer supported for Swizzling. Till now I've only had reports of some UITouch methods failing.
patchthecode commentedon Jun 23, 2020
Do you know or have the issue# of the touch methods failing?
I am assuming it was referenced in some other issue.
steipete commentedon Jun 24, 2020
I'm doing some investigation here; it seems
UITouchhas been changed quite a bit.KIF is facing the same issue: kif-framework/KIF#1152
Just commenting out
setIsTap:and_setIsFirstTouchForView:doesn't fix the issue, taps no longer work.steipete commentedon Jun 24, 2020
This seems to be an okay replacement - need more testing tho: (See the PSPDFKit marked part)
tirodkar commentedon Jun 24, 2020
We can track the issue here. Issues seen till now -
I'll have 1 / 2 sent to earlgrey2 on Github by EOD.
steipete commentedon Jun 25, 2020
Curious with what workaround you came up with. Our EarlGrey v1 fork now passes all tests again with above change.
tirodkar commentedon Jun 30, 2020
Sorry for the delay here as I was testing this out more.
For recordFailure, the fix is present here - #1377
Will send the UITouch fix tomorrow.
We haven't seen any of our swizzling code fail till now, so the private API's we are using seem to be fine with the current beta. However, we would want to move away from the more private classes such as
__NSCFLocalDataTaskin the future.LeoNatan commentedon Jun 30, 2020
In our Detox Sync, we went even more all-in on the
__NSCFLocalDataTasktracking because it was more accurate to track network like that. 😣So far, that API has not been hidden, but some other stuff in the network classes was hidden.
tirodkar commentedon Jul 1, 2020
Yes, the current swizzling code seems fine, though if you have any other alternatives in Detox, I'll be really happy to take a look.
BTW, UITouch fixes are here - #1378. @steipete - our solution is a bit different from the code you shared. We are obtaining the struct for the UITouchFlags and then changing the
_setIsFirstTouchToViewto YES.xavierjurado commentedon Jul 8, 2020
Do you plan to backport the UITouch fix to EarlGrey 1 as well @tirodkar ? If not, would you accept a pull request?
LeoNatan commentedon Jul 9, 2020
Probably a good idea to go over the internal API headers available in EG and see which is relevant and which isn't, to prevent usage of hidden API by people in the future.
yongjincho92 commentedon Jul 17, 2020
@steipete I have tried your fix and hitting this error :
I do not see the function
setIsTapToClick:YESon the Earlgrey repo either. Is this something custom in your fork of Earlgrey?tirodkar commentedon Jul 17, 2020
@xavierjurado we do not plan to add it or support EarlGrey 1.0 going forward. If you sent a PR, we could take a look at it, but it won't be vetted out from our side.
@LeoNatan Yes, I have a doc I'm working on about the private API's that we use. Some of the chief ones causing concern are the data tracking classes we use - __NSCFLocalDataTask. Happy to get any suggestions from your side on how to track network requests without it.
@ThreeFingerCoder - That code is pushed to the Github Repo here. Where are you building the code from?
yongjincho92 commentedon Jul 17, 2020
@tirodkar Sorry I have a fork of the earlgrey locally, and was testing on it.
This actually solved the issue I had above.
LeoNatan commentedon Jul 17, 2020
@tirodkar We too are swizzling
__NSCFLocalDataTaskmethods, but mostly public ones, such asresumeandsuspend. We're also swizzlingconnection:didFinishLoadingWithError:, which is also "public" because it's called by another class (and also I think comes from a protocol), and I don't think theirdirectimplementation survives this barrier. So for now, it's safe.https://github.com/wix/DetoxSync/blob/master/DetoxSync/DetoxSync/Spies/NSURLSessionTask%2BDTXSpy.m
Otherwise we now swizzle public
NSURLSessionmethods which should be safe:https://github.com/wix/DetoxSync/blob/master/DetoxSync/DetoxSync/Spies/NSURLSession%2BDTXSpy.m
I took a slightly different approach to swizzling the user's delegate. I subclass the user's class dynamically so that we avoid the issues with analytic and crash handling frameworks (this is a historic issue we had with Earl Grey, which we solved in a PR but there is still potential for issues).
Ideas how to do this can be found here:
https://github.com/wix/DTXObjectiveCHelpers/blob/a05861bfe0a1b227cd6308fd834a7fce532e77e8/DTXSwizzlingHelper.h#L99
In another project, used for profiling applications, which I haven't yet looked to "modernize" for iOS 14, I have more private stuff swizzled for
__NSCFLocalDataTaskwhich I need to consider how to sidestep.steipete commentedon Jul 18, 2020
@ThreeFingerCoder Yup, just a private header to allow calling the function.