今是昨非

今是昨非

日出江花红胜火,春来江水绿如蓝

Find which SDKs are using the clipboard for iOS 14 adaptation.

How to find which SDKs are using the clipboard for iOS 14 adaptation#

Background#

After the release of the iOS 14 public beta, our app started showing a prompt to read the clipboard when launched from the background. We needed to investigate this for security reasons. We performed a global search in our app and found no code related to reading the clipboard. It seemed like a third-party SDK issue. However, our project integrated more than a dozen third-party SDKs, and it would be time-consuming to check and remove them one by one. There were too many possible combinations if multiple SDKs were involved.

After suffering from a headache for several days, I sought help from the knowledgeable V friends and group members, and finally found a good solution.

  • Step 1: Use Xcode's Symbolic breakpoint to debug [UIPasteboard generalPasteboard]. Set a breakpoint and follow the steps to reproduce the issue. For example, if the prompt appears when our app is launched from the background, set a breakpoint and go through that process.

Screen Shot 2020-07-12 at 11.30.17 AM.png

Screen Shot 2020-07-12 at 11.30.42 AM.png

  • Step 2: The breakpoint will stop at the place where the method is called. Then, check above and below to see if you can identify the caller. If you still can't determine which SDK is causing the issue, step through a few more lines of code to find the caller.

0317730D3162C939A663AE043F366D05.png

Screen Shot 2020-07-12 at 10.49.52 AM.png

  • Step 3: Once the specific class that is making the call is exposed, how do you determine which SDK it belongs to? Use the following commands in the project directory (thanks to the help of group members):
find . -type f | grep -e ".framework" | xargs grep -s UIPasteboard
find . -type f | grep -e ".a" | xargs grep -s AUPasteboard

This will display the following:
WeChatcd3553691c3162a7f264d943c75906c6.png

From this, you can see that this class belongs to the Alipay SDK. After removing the SDK, check if the issue is resolved. If not, repeat this process to confirm if there are any other SDKs making similar calls.

Reference#

请教一下大家,关于 iOS14 读取剪切板的问题

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.