iOS 8 - 无法表示来自自定义动态框架

时间:2016-01-07 16:40:27

标签: ios swift frameworks symbolicatecrash dsym

以下是我所拥有的: - iOS应用程序名为VacationSpots(.APP文件)

  • app dSYM文件

  • 名为VSUtilities(.framework file)的动态框架

  • 动态框架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 个答案:

答案 0 :(得分:2)

今天面对类似的事情。我的案子有两个问题:

  1. .framework里面.app不会得到“索引足够”/获取mdfind的所有元数据,比如kMDItemDisplayName,除非我把它移出.app。

  2. symbolicatecrash使用mdfind和“kMDItemContentType == public.unix-executable”,而我的框架可执行文件的真实kMDItemContentType是“public.data”。

  3. 通过以下方式解决:

    1. 将.framework移出.app(在我的情况下,我将所有内容移动到桌面,以确保它将被正确编入索引)

    2. 修改(复制)symbolicatecrash,不仅要查找“kMDItemContentType == public.unix-executable”,还要查找“kMDItemContentType == public.data”

    3. P.S。您可以使用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中修补脚本让我能够用自定义动态框架来表示崩溃。