想着给已有项目配置修复一下国际化问题,刚开始还能运行后续运行报错如下,各种方法都没有找到原因。代码基本没有任何改动,后续发现已上线的测试版本也无法运行。目前定位应该是在入口的@main开始发生问题,也怀疑是 Localizable.strings 的问题,但实际上没有任何修改记录。
报错如下
2023-07-16 04:13:48.942021+0800 PDFPhoto Protector[9808:134268] -[NSTaggedPointerString count]: unrecognized selector sent to instance 0xb4fad2e3e13e9cba
2023-07-16 04:13:48.942928+0800 PDFPhoto Protector[9808:134268] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString count]: unrecognized selector sent to instance 0xb4fad2e3e13e9cba'
*** First throw call stack:
(
0 CoreFoundation 0x00000001a319b154 __exceptionPreprocess + 176
1 libobjc.A.dylib 0x00000001a2cba4d4 objc_exception_throw + 60
2 CoreFoundation 0x00000001a3242110 -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x00000001a31030a0 ___forwarding___ + 1600
4 CoreFoundation 0x00000001a31029a0 _CF_forwarding_prep_0 + 96
5 CoreFoundation 0x00000001a31df09c _CFLocaleCreateLocaleIdentifierForAvailableLocalizations + 76
6 CoreFoundation 0x00000001a30df058 _CFLocaleCopyCurrentGuts + 816
7 CoreFoundation 0x00000001a30decfc +[NSLocale currentLocale] + 16
8 Foundation 0x00000001a4044dcc -[NSUserDefaults(NSUserDefaults) init] + 1136
9 Foundation 0x00000001a4044910 +[NSUserDefaults(NSUserDefaults) standardUserDefaults] + 64
10 AppKit 0x00000001a630c804 +[NSApplication initialize] + 88
11 libobjc.A.dylib 0x00000001a2caaff0 CALLING_SOME_+initialize_METHOD + 24
12 libobjc.A.dylib 0x00000001a2caac9c initializeNonMetaClass + 904
13 libobjc.A.dylib 0x00000001a2cc50e8 _ZL24initializeAndMaybeRelockP10objc_classP11objc_objectR12locker_mixinIN9lockdebug10lock_mixinI16objc_lock_base_tEEEb + 156
14 libobjc.A.dylib 0x00000001a2caa5c4 lookUpImpOrForward + 884
15 libobjc.A.dylib 0x00000001a2ca9f64 _objc_msgSend_uncached + 68
16 AppKit 0x00000001a630c59c NSApplicationMain + 376
17 PDFPhoto Protector 0x0000000100bd7618 $sSo21NSApplicationDelegateP6AppKitE4mainyyFZ + 40
18 PDFPhoto Protector 0x0000000100bd75e0 $s18PDFPhoto_Protector11AppDelegateC5$mainyyFZ + 44
19 PDFPhoto Protector 0x0000000100bd76b0 main + 28
20 dyld 0x00000001a2cebf28 start + 2236
)
libc++abi: terminating due to uncaught exception of type NSException
(lldb)
import Cocoa
@main
class AppDelegate: NSObject, NSApplicationDelegate {