When running xcodebuild to programmatically export or import xcloc resources, I receive an internal error and do not know how to proceed.
Note: Export and import localizations within Xcode does complete successfully. Is there a way to see the exact xcodebuild command run by Xcode?
For example:
xcodebuild -exportLocalizations -project ./MyProject.xcodeproj -localizationPath destination -exportLanguage da
output: xcodebuild appears to successfully build my project, and then fails once "Copying source language files". There are several suspicious entries in the output of all the detected strings. For example:
...
...
0.01ms /pathtomyproject/File.swift:19:21 setter cancellable
0.01ms /pathtomyproject/File.swift:19:21 _modify accessor cancellable
0.10ms /pathtomyproject/File.swift:21:5 initializer init(sceneFlow:)
5.49ms /pathtomyproject/File.swift:25:10 instance method viewControllerForOnboardScene()
0.00ms /pathtomyproject/File.swift:15:13 deinitializer deinit
0.86ms <invalid loc> initializer init(rawValue:)
0.12ms <invalid loc> getter rawValue
0.02ms <invalid loc> static method __derived_enum_equals(_:_:)
0.52ms <invalid loc> instance method hash(into:)
0.04ms <invalid loc> getter hashValue
...
...
2023-06-12 13:52:36 Extracting strings from localizable files
2023-06-12 13:52:36 Copying source language files
2023-06-12 13:52:36.804 xcodebuild[22356:3140982] -[NSTaggedPointerString unsignedIntegerValue]: unrecognized selector sent to instance 0x964eda74bb606deb
2023-06-12 13:52:36.815 xcodebuild[22356:3140982] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString unsignedIntegerValue]: unrecognized selector sent to instance 0x964eda74bb606deb'
*** First throw call stack:
(
0 CoreFoundation 0x000000019e2f7154 __exceptionPreprocess + 176
1 libobjc.A.dylib 0x000000019de164d4 objc_exception_throw + 60
2 CoreFoundation 0x000000019e39e110 -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x000000019e25f0a0 ___forwarding___ + 1600
4 CoreFoundation 0x000000019e25e9a0 _CF_forwarding_prep_0 + 96
5 Localization 0x0000000108eb6cbc -[LOCStringsdataFile initWithPropertyListRepresentation:error:] + 140
6 Localization 0x0000000108eb6984 -[LOCStringsdataFile initWithJSONData:error:] + 124
7 Localization 0x0000000108eb6564 -[LOCStringsdataFile initWithContentsOfURL:error:] + 124
8 Localization 0x0000000108f2fc50 -[LOCRequest _preprocessStringsdata:error:] + 376
9 Localization 0x0000000108f2f490 __19-[LOCRequest start]_block_invoke_3 + 112
10 Foundation 0x000000019f1d9254 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 24
11 Foundation 0x000000019f1d9114 -[NSBlockOperation main] + 104
12 Foundation 0x000000019f1d90a4 __NSOPERATION_IS_INVOKING_MAIN__ + 16
13 Foundation 0x000000019f1d84bc -[NSOperation start] + 708
14 Foundation 0x000000019f1d81f0 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 16
15 Foundation 0x000000019f1d80e0 __NSOQSchedule_f + 172
16 libdispatch.dylib 0x000000019dfff518 _dispatch_block_async_invoke2 + 148
17 libdispatch.dylib 0x000000019dff0400 _dispatch_client_callout + 20
18 libdispatch.dylib 0x000000019dff3884 _dispatch_continuation_pop + 504
19 libdispatch.dylib 0x000000019dff2eec _dispatch_async_redirect_invoke + 584
20 libdispatch.dylib 0x000000019e001e98 _dispatch_root_queue_drain + 396
21 libdispatch.dylib 0x000000019e0026c0 _dispatch_worker_thread2 + 164
22 libsystem_pthread.dylib 0x000000019e19c038 _pthread_wqthread + 228
23 libsystem_pthread.dylib 0x000000019e19ad94 start_wqthread + 8
)
** INTERNAL ERROR: Uncaught exception **
Uncaught Exception: -[NSTaggedPointerString unsignedIntegerValue]: unrecognized selector sent to instance 0x964eda74bb606deb
Stack:
0 __exceptionPreprocess (in CoreFoundation)
1 objc_exception_throw (in libobjc.A.dylib)
2 -[NSObject(NSObject) __retain_OA] (in CoreFoundation)
3 ___forwarding___ (in CoreFoundation)
4 _CF_forwarding_prep_0 (in CoreFoundation)
5 -[LOCStringsdataFile initWithPropertyListRepresentation:error:] (in Localization)
6 -[LOCStringsdataFile initWithJSONData:error:] (in Localization)
7 -[LOCStringsdataFile initWithContentsOfURL:error:] (in Localization)
8 -[LOCRequest _preprocessStringsdata:error:] (in Localization)
9 __19-[LOCRequest start]_block_invoke_3 (in Localization)
10 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ (in Foundation)
11 -[NSBlockOperation main] (in Foundation)
12 __NSOPERATION_IS_INVOKING_MAIN__ (in Foundation)
13 -[NSOperation start] (in Foundation)
14 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ (in Foundation)
15 __NSOQSchedule_f (in Foundation)
16 _dispatch_block_async_invoke2 (in libdispatch.dylib)
17 _dispatch_client_callout (in libdispatch.dylib)
18 _dispatch_continuation_pop (in libdispatch.dylib)
19 _dispatch_async_redirect_invoke (in libdispatch.dylib)
20 _dispatch_root_queue_drain (in libdispatch.dylib)
21 _dispatch_worker_thread2 (in libdispatch.dylib)
22 _pthread_wqthread (in libsystem_pthread.dylib)
23 start_wqthread (in libsystem_pthread.dylib)
[1] 22356 abort xcodebuild -exportLocalizations -project ./MyProject.xcodeproj da