Class-dump导出头文件时,为什么会这样报错?

zx$ class-dump --arch arm64 -H Confirmed.decrypted -o /Users/zx/Documents/heads
2017-12-07 14:56:24.562 class-dump[1828:384084] *** Assertion failure in -[CDObjectiveC2Processor loadIvarsAtAddress:], /Volumes/Lion/Users/nygard/Source/git/me/Tools/class-dump/Source/CDObjectiveC2Processor.m:411
2017-12-07 14:56:24.562 class-dump[1828:384084] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Invalid parameter not satisfying: [cursor offset] != 0’
*** First throw call stack:
(
0 CoreFoundation 0x00007fff31ece2fb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fff5883fc76 objc_exception_throw + 48
2 CoreFoundation 0x00007fff31ed4092 +[NSException raise:format:arguments:] + 98
3 Foundation 0x00007fff33fb0690 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 class-dump 0x000000010f518f96 class-dump + 159638
5 class-dump 0x000000010f517dd0 class-dump + 155088
6 class-dump 0x000000010f5164fc class-dump + 148732
7 class-dump 0x000000010f513abf class-dump + 137919
8 class-dump 0x000000010f4f3c19 class-dump + 7193
9 class-dump 0x000000010f50380b class-dump + 71691
10 libdyld.dylib 0x00007fff5942e145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

Swift混编

1 个赞

那有什么解决办法呢,在网站里面找到这个网址,但怎么使用呢:https://github.com/BlueCocoa/class-dump/

你试试用这个看能不能解决 https://github.com/AloneMonkey/MonkeyDev/blob/master/bin/class-dump

好的,十分感谢

原因:遇到了ObjC和Swift混编的情况,而你用的class-dump不(能很好的)支持swift的情况
导致了代码内部的assertion失败报错
解决办法:

  • 换个其他支持swift的class-dump

具体步骤: