google / google/EarlGrey

Earl Grey swizzling fails when proxy objects are used.

Open
#709 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Objective-C
Stars
5.7k
Forks
737
Avg merge
1d 20h
Merged PRs (30d)
5

Description

I've seen this issue with projects using [TrustKit](https://github.com/datatheorem/TrustKit) and [Detox](https://github.com/wix/detox), but this is a general problem of Earl Grey.

Fox example, in NSURLSession+GREYAdditions.m, `greyswizzled_dataTaskWithRequest:completionHandler:`, the code checks if `[delegate respondsToSelector:originalSel]`, but later, `class_getInstanceMethod` returns `NULL` because the `delegate` instance is actually a proxy which implements `respondsToSelector:` and `forwardingTargetForSelector:`.

I will submit a PR with a special case fix for the case above, but consider refactoring any swizzling mechanisms taking into account `forwardingTargetForSelector:` at the very least.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.