今是昨非

今是昨非

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

iOS14 adaptation to find which SDKs use the clipboard

title: How to Find Which SDKs Use the Clipboard for iOS 14 Adaptation
tags:
- Technology
- iOS
date: 2020-07-12 12:42#

How to Find Which SDKs Use the Clipboard for iOS 14 Adaptation#

Background#

After the release of the iOS 14 public beta, our app started displaying a prompt to read the clipboard when launched from the background. We needed to investigate this security requirement. 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 checking and removing them one by one would be time-consuming due to the many possible combinations.

After several days of headache, we 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 this 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 location where the method is called. Then, inspect the code above and below. If you still cannot determine which SDK is causing the issue, step through the code a few more times until you find the caller.

0317730D3162C939A663AE043F366D05.png

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

  • Step 3: Once you have identified the specific class being called, how do you determine which SDK it belongs to? Use the following command in the project directory (thanks to the help from 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 result:
WeChatcd3553691c3162a7f264d943c75906c6.png

In this case, the class belongs to the Alipay SDK. After removing the SDK, check if the issue is resolved. If not, repeat this process to confirm if any other SDKs also have similar calls.

Reference#

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

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