iOS 8 - 无法符号化来自自定义动态框架的符号
Posted
技术标签:
【中文标题】iOS 8 - 无法符号化来自自定义动态框架的符号【英文标题】:iOS 8 - Unable to symbolicate symbols coming from custom dynamic framework 【发布时间】:2016-01-07 16:40:27 【问题描述】:这是我所拥有的: - ios 应用程序称为 VacationSpots(.APP 文件)
应用 dSYM 文件
名为 VSUtilities 的动态框架(.framework 文件)
动态框架 dSYM 文件
这里是示例项目源代码:https://www.dropbox.com/s/nl32xlk98lnl1mv/VacationSpots.zip?dl=0
我通过强制解开一个 nil 选项使应用程序在启动时崩溃。
以下是符号化崩溃报告的一部分。请注意,VSUtilities 调用没有符号化:
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libswiftCore.dylib 0x00333470 0x1d1000 + 1451120
1 VSUtilities 0x001c0bd8 0x1b9000 + 31704
2 VacationSpots 0x0007a418 SpotsViewController.awakeFromNib() -> () (SpotsViewController.swift:38)
3 VacationSpots 0x0007a4b8 @objc SpotsViewController.awakeFromNib() -> () (SpotsViewController.swift:0)
4 UIKit 0x2940036a -[UINib instantiateWithOwner:options:] + 1910
5 UIKit 0x29641818 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 196
6 UIKit 0x2964197a -[UIStoryboard instantiateInitialViewController] + 58
7 UIKit 0x291f8ea0 -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 84
8 UIKit 0x28fccebc -[UIApplication _loadMainInterfaceFile] + 260
9 UIKit 0x291f7d80 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1256
10 UIKit 0x2920bb9c __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke3228 + 36
11 UIKit 0x291f53aa -[UIApplication workspaceDidEndTransaction:] + 134
12 FrontBoardServices 0x26100c7e -[FBSSerialQueue _performNext] + 230
13 FrontBoardServices 0x26100f70 -[FBSSerialQueue _performNextFromRunLoopSource] + 48
14 CoreFoundation 0x24ddf68e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
15 CoreFoundation 0x24ddf27c __CFRunLoopDoSources0 + 452
16 CoreFoundation 0x24ddd5ea __CFRunLoopRun + 794
17 CoreFoundation 0x24d30bf8 CFRunLoopRunSpecific + 520
18 CoreFoundation 0x24d309e4 CFRunLoopRunInMode + 108
19 UIKit 0x28fc65bc -[UIApplication _run] + 524
20 UIKit 0x28fc0ba0 UIApplicationMain + 144
21 VacationSpots 0x00081d4c main (AppDelegate.swift:26)
22 libdyld.dylib 0x249df872 start + 2
这是symbolicatecrash
命令输出的一部分:
Finding Symbols:
.fetching symbol file for VSUtilities--[undef]
Searching []...-- NO MATCH
Searching in Spotlight for dsym with UUID of 9acae8d3326233adaaea24609e951306
Running mdfind "com_apple_xcode_dsym_uuids == 9ACAE8D3-3262-33AD-AAEA-24609E951306"
Running mdls -name com_apple_xcode_dsym_paths \/Users\/maxkorytko\/Library\/Developer\/Xcode\/DerivedData\/VacationSpots\-citeoysntsbhwwfzcqytfuzhnqze\/Build\/Products\/Debug\-iphoneos\/VSUtilities\.framework\.dSYM
@dsym_paths = ( /Users/maxkorytko/Library/Developer/Xcode/DerivedData/VacationSpots-citeoysntsbhwwfzcqytfuzhnqze/Build/Products/Debug-iphoneos/VSUtilities.framework.dSYM/Contents/Resources/DWARF/VSUtilities )
@exec_names = ( VSUtilities )
Running mdfind "kMDItemContentType == com.apple.application-bundle && (kMDItemAlternateNames == 'VSUtilities.app' || kMDItemDisplayName == 'VSUtilities' || kMDItemDisplayName == 'VSUtilities.app')"
Running mdfind "kMDItemContentType == public.unix-executable && kMDItemDisplayName == 'VSUtilities'"
Did not find executable for dsym
## Warning: Can't find any unstripped binary that matches version of /var/mobile/Containers/Bundle/Application/BE14C237-9798-4030-9806-11F3386A0077/VacationSpots.app/Frameworks/VSUtilities.framework/VSUtilities
..fetching symbol file for VacationSpots--[undef]
Searching []...-- NO MATCH
Searching in Spotlight for dsym with UUID of d2731d399b5132329532fea91df1ca19
Running mdfind "com_apple_xcode_dsym_uuids == D2731D39-9B51-3232-9532-FEA91DF1CA19"
Running mdls -name com_apple_xcode_dsym_paths \/Users\/maxkorytko\/Library\/Developer\/Xcode\/DerivedData\/VacationSpots\-citeoysntsbhwwfzcqytfuzhnqze\/Build\/Products\/Debug\-iphoneos\/VacationSpots\.app\.dSYM
@dsym_paths = ( /Users/maxkorytko/Library/Developer/Xcode/DerivedData/VacationSpots-citeoysntsbhwwfzcqytfuzhnqze/Build/Products/Debug-iphoneos/VacationSpots.app.dSYM/Contents/Resources/DWARF/VacationSpots )
@exec_names = ( VacationSpots )
Running mdfind "kMDItemContentType == com.apple.application-bundle && (kMDItemAlternateNames == 'VacationSpots.app' || kMDItemDisplayName == 'VacationSpots' || kMDItemDisplayName == 'VacationSpots.app')"
Running mdfind "kMDItemContentType == public.unix-executable && kMDItemDisplayName == 'VacationSpots'"
Running /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo -info '/Users/maxkorytko/Library/Developer/Xcode/DerivedData/VacationSpots-citeoysntsbhwwfzcqytfuzhnqze/Build/Products/Debug-iphoneos/VacationSpots.app/VacationSpots'
Running /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool -arch armv7 -l '/Users/maxkorytko/Library/Developer/Xcode/DerivedData/VacationSpots-citeoysntsbhwwfzcqytfuzhnqze/Build/Products/Debug-iphoneos/VacationSpots.app/VacationSpots'
Number of symbols in /Users/maxkorytko/Library/Developer/Xcode/DerivedData/VacationSpots-citeoysntsbhwwfzcqytfuzhnqze/Build/Products/Debug-iphoneos/VacationSpots.app/VacationSpots: 335 + 2081 = 2416
Found executable /Users/maxkorytko/Library/Developer/Xcode/DerivedData/VacationSpots-citeoysntsbhwwfzcqytfuzhnqze/Build/Products/Debug-iphoneos/VacationSpots.app/VacationSpots
-- MATCH
【问题讨论】:
【参考方案1】:今天遇到了类似的事情。我的情况有两个问题:
.app 中的 .framework 无法获得“足够索引”/获取 mdfind 的所有元数据,例如 kMDItemDisplayName,除非我将其移出 .app。
symbolicatecrash 使用带有“kMDItemContentType == public.unix-executable”的 mdfind,而我的框架可执行文件的真正 kMDItemContentType 是“public.data”。
通过以下方式解决它:
将 .framework 从 .app 中移出(在我的例子中,我将所有的东西都移到了桌面,以确保它被正确编入索引)
修改(复制) symbolicatecrash 以不仅查找“kMDItemContentType == public.unix-executable”,还查找“kMDItemContentType == public.data”
附:您可以使用 mdls 来获取文件的索引元数据属性:
MacBook-Pro-GE:~ eg$ mdls -name kMDItemContentType ~/Desktop/OPASAppKit.framework/OPASAppKit
kMDItemContentType = "public.data"
至于symbolicatecrash的修改版本,我不确定我是否可以按原样发布,但这里有一个差异,只有一行发生了变化。
https://gist.githubusercontent.com/grigorye/25dbfe64e6d91db21817/raw/6e33f1d77abca6ffc022bedefcd5a5f1d1bc308f/symbolicatecrash-publicdata.diff
顺便说一句,看起来 Xcode 也使用 symbolicatecrash 进行符号化,因此在 Xcode 中修补脚本让我也可以使用自定义动态框架来符号化崩溃。
【讨论】:
太棒了。谢谢你的提示。我一定会试一试的。 你好 Grigory,你能复制和粘贴你的 symbolicatecrash 文件吗?另外,您是如何确定您的框架的 kMDItemContentType 类型是“public.data”的? 你好格里高利。非常感谢你帮助我。我向 Apple 开了一张支持票,他们给我发电子邮件说我需要为此打开一个错误报告。我也这样做了。我将更新错误报告以指向该线程。谢谢!以上是关于iOS 8 - 无法符号化来自自定义动态框架的符号的主要内容,如果未能解决你的问题,请参考以下文章