gpt4 book ai didi

ios - Xcode 9 - 框架断点

转载 作者:可可西里 更新时间:2023-11-01 03:34:04 25 4
gpt4 key购买 nike

在 Xcode 7 和 8 中,我已经能够通过在还包含框架项目的 xcworkspace 中运行包含应用程序来调试我一直在开发的框架。如果我在框架中设置断点,它们将在运行时被触发。

在 Xcode 9 beta 6 中,情况不再如此。到目前为止,在模拟器上调试时,执行仅在框架断点处停止。当我在物理设备上调试时,框架断点不会停止执行,而且它们似乎被完全忽略了。

如何让框架断点正常工作,以便在 Xcode 9 中调试 iOS 11 上的框架?

FWIW:xcworkspace 是通过在框架根目录中运行 pod install 创建的。然后我将示例应用程序的 xcodeproj 添加到 xcworkspace。在 Xcode 9 beta 6 上测试之前,这一直有效。

编辑:确认此行为仍然发生在 Xcode 9.0 的 GM 种子上。

最佳答案

TL;DR - 我需要更改存档脚本在调试或准备发布时从中读取的目录。现在在调试时,如果我希望断点在运行时正常工作,我需要确保将我的框架方案的存档配置设置为“调试”。我只在准备生产就绪的 .framework 时使用“发布”。

我通过错误报告联系了 Apple 开发人员支持。我将在下面粘贴回复。当他提到“lipo”时,他指的是我在存档后脚本中进行的调用,该脚本从模拟器和物理设备构建中创建了一个通用框架。

Xcode has to match up the binary that's running with the debug symbols that are still on your machine. Xcode should do that automatically, but it sounds like some stuff is moved around behind Xcode's back. To know whether the debug information matches you can look at the output of (lldb) image list and /Mac/path/to/Build/Products/Debug-iphoneos% dwarfdump --uuid iOS-App.app/iOS-App that will work on dylibs too.

Does your framework have parenthesis around the address? That's a sure sign that lldb can't find your symbols.

if the UUID in image list doesn't match the dwarfdump, then something has modified the executable before it ran and doesn't match your built products. We’re not sure if lipo might do that, which I see in your script but definitely check. Not much can be done if the debug-info no longer exists.

If you can find the right executable with a matching UUID on your disk, you can simply (lldb) image add /Mac/path/to/DerivedData-asdfasdfadf/Products/Debug-iphoneos/iOS-App.app/Frameworks/Framework

Additionally, Xcode uses Spotlight to find symbols on your machine. To avoid constantly re-indexing while building, the Intermediates/ directory containing .o files and other place where debug information is stored was blacklisted. This happened fairly late in Xcode 9.0 so may be the reason your stuff was working before.

当我在运行时运行 (lldb) image list 时,我发现我的框架的 UUID 与 dwarfdump/报告的不匹配Mac/path/to/Build/Products/Debug-iphoneos.

我最终修改了存档后脚本,以更改它在创建框架时从中读取的构建目录。当我将存档配置设置为“调试”时,它现在将从 Debug-iphoneos 读取。当我将它设置为“发布”时,它从 ${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}

中读取
# NOTE: This script creates a universal framework (device and simulator). However, *** for this to work: a Simulator target must be built first, and then Archive on the Device ***

BUILD_PRODUCTS="${SYMROOT}/../../../../Products"
SIM_PATH="${BUILD_PRODUCTS}/Debug-iphonesimulator/${TARGET_NAME}.framework"
if [ "${CONFIGURATION}" = "Debug" ]; then
DEV_PATH="${BUILD_PRODUCTS}/Debug-iphoneos/${TARGET_NAME}.framework"
elif [ "${CONFIGURATION}" = "Release" ]; then
DEV_PATH="${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/${TARGET_NAME}.framework"
fi
DEST_PATH="${PROJECT_DIR}/../Frameworks/${TARGET_NAME}.framework"

rm -rf "${DEST_PATH}"
mkdir "${DEST_PATH}"
cp -r "${DEV_PATH}/" "${DEST_PATH}/"
rm -f "${DEST_PATH}/${TARGET_NAME}"
cp -Rn "${SIM_PATH}/Modules/" "${DEST_PATH}/Modules/"

lipo -create "${SIM_PATH}/${TARGET_NAME}" "${DEV_PATH}/${TARGET_NAME}" -output "${DEST_PATH}/${TARGET_NAME}"

如果路径令人困惑,我不怪你。本质上,工作区看起来像:

RootDirectory
|__SampleApp
|__SampleApp.xcodeproj
|__Frameworks
|__MyFramework.framework
|__AnotherFramework.framework
|__MyFramework
|__MyFramework.xcworkspace
|__MyFramework.xcodeproj
|__Podfile (etc..)

关于ios - Xcode 9 - 框架断点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45972443/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com