使用 SwiftUI 2.0 在 Xcode 13 中编译资产目录错误

问题描述 投票:0回答:2

,

我有一个非常大的错误,我的项目找不到我的资产,我一直删除副本捆绑资源中项目的资产,并且我的项目可以工作,但如果我添加它会抛出此错误:

CompileAssetCatalog /Users/jxr0721/Library/Developer/Xcode/DerivedData/ZabulonApp-cwdueaevkgvjznbmjsxbvmqosobm/Build/Products/Debug-iphonesimulator/ZabulonApp.app /Users/jxr0721/Desktop/Personal/ZabulonApp/ZabulonApp/Assets.xcassets /Users/jxr0721/Desktop/Personal/ZabulonApp/ZabulonApp/Preview\ Content/Preview\ Assets.xcassets (in target 'ZabulonApp' from project 'ZabulonApp')
cd /Users/jxr0721/Desktop/Personal/ZabulonApp
/Applications/Xcode.app/Contents/Developer/usr/bin/actool --output-format human-readable-text --notices --warnings --export-dependency-info /Users/jxr0721/Library/Developer/Xcode/DerivedData/ZabulonApp-cwdueaevkgvjznbmjsxbvmqosobm/Build/Intermediates.noindex/ZabulonApp.build/Debug-iphonesimulator/ZabulonApp.build/assetcatalog_dependencies --output-partial-info-plist /Users/jxr0721/Library/Developer/Xcode/DerivedData/ZabulonApp-cwdueaevkgvjznbmjsxbvmqosobm/Build/Intermediates.noindex/ZabulonApp.build/Debug-iphonesimulator/ZabulonApp.build/assetcatalog_generated_info.plist --app-icon AppIcon --accent-color AccentColor --compress-pngs --enable-on-demand-resources YES --filter-for-device-model iPhone12,5 --filter-for-device-os-version 15.0 --development-region en --target-device iphone --target-device ipad --minimum-deployment-target 14.0 --platform iphonesimulator --compile /Users/jxr0721/Library/Developer/Xcode/DerivedData/ZabulonApp-cwdueaevkgvjznbmjsxbvmqosobm/Build/Products/Debug-iphonesimulator/ZabulonApp.app /Users/jxr0721/Desktop/Personal/ZabulonApp/ZabulonApp/Assets.xcassets /Users/jxr0721/Desktop/Personal/ZabulonApp/ZabulonApp/Preview\ Content/Preview\ Assets.xcassets


2021-10-14 15:14:10.309 ibtoold[99039:686928] DEBUG: Added to environment: {
TMPDIR = "/var/folders/2x/4w3vtvq56v78kn9cr9hwrvg0p2yb9m/T/22F67277-03B9-46FC-BC43-       2881B2D11656";
  }
       2021-10-14 15:14:56.803 ibtoold[99039:686928] *** Terminating app due to   uncaught exception 'IBPlatformToolFailureException', reason: 'The tool closed the   connection (AssetCatalogSimulatorAgent)

  Last command:
  _ON_QUEUE_sendMessage:toChannelReturningError:during:

  Backtrace of last command:
  0   -[IBAbstractPlatformToolProxy _ON_QUEUE_sendMessage:toChannelReturningError:during:] (in IDEInterfaceBuilderKit)
   1   __74-[IBAbstractPlatformToolProxy sendMessage:toChannelReturningError:during:]_block_invoke (in IDEInterfaceBuilderKit)
   2   _dispatch_client_callout (in libdispatch.dylib)
   3   _dispatch_lane_barrier_sync_invoke_and_complete (in libdispatch.dylib)
   4   DVTDispatchSync (in DVTFoundation)
   5   -[IBAbstractPlatformToolProxy sendMessage:toChannelReturningError:during:] (in IDEInterfaceBuilderKit)
   6   -[AssetCatalogSimulatorAgentProxy compileItemsWithCatalogRelativeIdentifierPaths:tagSolutionSpace:andStickerPacksWithCatalogRelativeIdentifierPaths:options:] (in IDEInterfaceBuilderCocoaTouchIntegration)
   7   -[IBICSimulatorToolCARCompiler compileCARItems:tagSolutionSpace:options:queue:completionHandler:] (in AssetCatalogCocoaTouchKit)
   8   -[IBICAbstractPlatformAdapter compileCARItems:tagSolutionSpace:options:queue:completionHandler:] (in AssetCatalogFoundation)
   9   __84-[IBICAbstractPlatformAdapter compileSelectedItems:options:queue:completionHandler:]_block_invoke (in AssetCatalogFoundation)
  10   __93-[IBICAbstractPlatformAdapter compileStandaloneCatalogItems:options:queue:completionHandler:]_block_invoke (in AssetCatalogFoundation)
  11   __DVT_CALLING_CLIENT_BLOCK__ (in DVTFoundation)
  12   __DVTDispatchAsync_block_invoke (in DVTFoundation)
  13   _dispatch_call_block_and_release (in libdispatch.dylib)
  14   _dispatch_client_callout (in libdispatch.dylib)
  15   _dispatch_main_queue_callback_4CF (in libdispatch.dylib)
  16   __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ (in CoreFoundation)
  17   __CFRunLoopRun (in CoreFoundation)
  18   CFRunLoopRunSpecific (in CoreFoundation)
  19   -[NSRunLoop(DVTNSRunLoopAdditions) dvt_spinRunLoopInMode:whileQueue:executesAsynchronously:] (in DVTFoundation)
  20   -[NSRunLoop(DVTNSRunLoopAdditions) dvt_spinRunLoopInMode:whileBlockExecutesConcurrently:] (in DVTFoundation)
 21   -[NSRunLoop(DVTNSRunLoopAdditions) dvt_spinRunLoopInMode:waitingForSemaphore:] (in DVTFoundation)
 22   -[IBCLIImageCatalogToolPersona compileCatalogCollection:withPlatformAdapter:arguments:outputDictionary:] (in ibtoold)
 23   -[IBCLIImageCatalogToolPersona invokeArguments:outputDictionary:] (in ibtoold)
 24   -[IBCLIImageCatalogToolPersona runSingleInvocation:outputtingToFileHandle:andVerifyingEnvironment:] (in ibtoold)
 25   IBCLIServerRunSingleInvocation (in ibtoold)
 26   __IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess_block_invoke_2 (in ibtoold)
 27   __IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess_block_invoke (in ibtoold)
 28   -[IBCLIErrorForwarder forwardErrorOutputToDescriptor:whileInvokingBlock:] (in ibtoold)
 29   IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess (in ibtoold)
 30   main (in ibtoold)
 31   start (in libdyld.dylib)


 Execution Context:
 <IBSimulatorToolCoreSimulatorCLIExecutionContext: 0x7fd88d5ca6f0 busyCount=0, Idle   for 0.0 secs, lifeTime=46.5 secs>, device=IBSimDeviceTypeiPad2x (F9397425-162F-488A-  B343-C0EE2C049ED8, iOS 15.0, Shutdown), idiom=<IBIPhoneIdiom: 0x7fd81d4fdb30>

'

  *** First throw call stack:
   (
      0   CoreFoundation                      0x00007fff2056b1db    __exceptionPreprocess + 242
     1   libobjc.A.dylib                     0x00007fff202a4d92 objc_exception_throw + 48
     2   CoreFoundation                      0x00007fff205938e6 -[NSException raise] + 9
     3   IDEInterfaceBuilderKit              0x0000000103cb6f14 -[IBAbstractPlatformToolProxy _errorByAddingAdditionalCrashInformationToError:orRaiseIfNeededOnFailure:shouldRaiseOnFailures:waitForCrashLog:] + 1728
      4   IDEInterfaceBuilderKit              0x0000000103cb682a -[IBAbstractPlatformToolProxy errorByAddingAdditionalCrashInformationToError:orRaiseIfNeededOnFailure:] + 94
     5   IDEInterfaceBuilderKit              0x0000000103cb87d2 -[IBAbstractPlatformToolProxy _ON_QUEUE_sendMessage:toChannelReturningError:during:] + 207
     6   IDEInterfaceBuilderKit              0x0000000103cb86cb __74-[IBAbstractPlatformToolProxy sendMessage:toChannelReturningError:during:]_block_invoke + 38
7   libdispatch.dylib                   0x00007fff2024f806 _dispatch_client_callout + 8
8   libdispatch.dylib                   0x00007fff2025c5ce _dispatch_lane_barrier_sync_invoke_and_complete + 60
9   DVTFoundation                       0x00000001048f0fe0 DVTDispatchSync + 208
10  IDEInterfaceBuilderKit              0x0000000103cb85f0 -[IBAbstractPlatformToolProxy sendMessage:toChannelReturningError:during:] + 228
11  IDEInterfaceBuilderCocoaTouchIntegr 0x000000012167c3ae -[AssetCatalogSimulatorAgentProxy compileItemsWithCatalogRelativeIdentifierPaths:tagSolutionSpace:andStickerPacksWithCatalogRelativeIdentifierPaths:options:] + 213
12  AssetCatalogCocoaTouchKit           0x0000000116608924 -[IBICSimulatorToolCARCompiler compileCARItems:tagSolutionSpace:options:queue:completionHandler:] + 1053
13  AssetCatalogFoundation              0x0000000103b14a5d -[IBICAbstractPlatformAdapter compileCARItems:tagSolutionSpace:options:queue:completionHandler:] + 503
14  AssetCatalogFoundation              0x0000000103b13e65 __84-[IBICAbstractPlatformAdapter compileSelectedItems:options:queue:completionHandler:]_block_invoke + 225
15  AssetCatalogFoundation              0x0000000103b18310 __93-[IBICAbstractPlatformAdapter compileStandaloneCatalogItems:options:queue:completionHandler:]_block_invoke + 18
16  DVTFoundation                       0x00000001048efc37 __DVT_CALLING_CLIENT_BLOCK__ + 7
17  DVTFoundation                       0x00000001048f10b9 __DVTDispatchAsync_block_invoke + 185
18  libdispatch.dylib                   0x00007fff2024e623 _dispatch_call_block_and_release + 12
19  libdispatch.dylib                   0x00007fff2024f806 _dispatch_client_callout + 8
20  libdispatch.dylib                   0x00007fff2025bb4f _dispatch_main_queue_callback_4CF + 940
21  CoreFoundation                      0x00007fff2052df18 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
22  CoreFoundation                      0x00007fff204f0112 __CFRunLoopRun + 2755
23  CoreFoundation                      0x00007fff204eef8c CFRunLoopRunSpecific + 563
24  DVTFoundation                       0x000000010477fef9 -[NSRunLoop(DVTNSRunLoopAdditions) dvt_spinRunLoopInMode:whileQueue:executesAsynchronously:] + 438
25  DVTFoundation                       0x0000000104780168 -[NSRunLoop(DVTNSRunLoopAdditions) dvt_spinRunLoopInMode:whileBlockExecutesConcurrently:] + 87
26  DVTFoundation                       0x00000001047802d2 -[NSRunLoop(DVTNSRunLoopAdditions) dvt_spinRunLoopInMode:waitingForSemaphore:] + 119
27  ibtoold                             0x00000001039afc97 -[IBCLIImageCatalogToolPersona compileCatalogCollection:withPlatformAdapter:arguments:outputDictionary:] + 1662
28  ibtoold                             0x00000001039b17bb -[IBCLIImageCatalogToolPersona invokeArguments:outputDictionary:] + 2458
29  ibtoold                             0x00000001039b1ca8 -[IBCLIImageCatalogToolPersona runSingleInvocation:outputtingToFileHandle:andVerifyingEnvironment:] + 557
30  ibtoold                             0x00000001039bf584 IBCLIServerRunSingleInvocation + 510
31  ibtoold                             0x00000001039bfbaf __IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess_block_invoke_2 + 34
32  ibtoold                             0x00000001039bfa7a __IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess_block_invoke + 844
33  ibtoold                             0x00000001039ae6db -[IBCLIErrorForwarder forwardErrorOutputToDescriptor:whileInvokingBlock:] + 97
34  ibtoold                             0x00000001039bf1c5 IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess + 533
35  ibtoold                             0x00000001039be2d1 main + Command CompileAssetCatalog failed with a nonzero exit code.

我不知道发生了什么,我想这是一些资产,但我已经一一删除了它们,它不起作用,除非我删除所有,但我删除所有并添加新的,我的项目仍然无法工作.

有人处理过类似问题吗?

xcode swiftui assets
2个回答
20
投票

我用下面的方法解决。 我杀了后台模拟器。

sudo Killall -9 com.apple.CoreSimulator.CoreSimulatorService

https://developer.apple.com/forums/thread/687741


0
投票

这个问题和其他一些问题的一般答案,这对我来说确实有用:

  1. 创建一个新项目。

  2. 一次复制旧项目中的所有内容一个文件。

© www.soinside.com 2019 - 2024. All rights reserved.