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.
- 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.
- 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:
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.