'exported: true' 对 Xcode 12.5 中的 '_specialize' 属性没有影响

问题描述

在我的机器上,Xcode 已经自动升级到最新版本的 Xcode 12.5。我现在在构建我的项目时遇到了问题。它昨天在 Xcode 12.4 上完美运行,没有代码更改,也没有库更改。完全相同的代码库。

有人在解决此问题后遇到过这个问题吗?

收到错误信息:

'exported: true' has no effect in '_specialize' attribute

enter image description here

尝试过(但没有帮助):

  1. 重启机器
  2. 杀死并重启Xcode
  3. 干净的构建
  4. 删除派生数据

解决方法

我已经解决了运行 pod update 而不是指向我的 Podfile 中的特定版本的问题

否则,您也可以按照@coryhowell 指出的内容进行操作,

移除 pod 并将其添加为 Swift 包(版本 1.4.0)

Podfile

platform :ios,'11.4'
use_frameworks!
inhibit_all_warnings!

target 'myAppp' do
  pod 'Alamofire','~> 4.8.1'
  pod 'CryptoSwift'
end

Podfile.lock - 自动创建,然后指向最新版本的 CryptoSwift

PODS:
  - Alamofire (4.8.2)
  - Countly (20.11.1):
    - Countly/Core (= 20.11.1)
  - Countly/Core (20.11.1)
  - Crashlytics (3.12.0):
    - Fabric (~> 1.9.0)
  - CryptoSwift (1.4.0)
  - Device (3.1.2)
  - Fabric (1.9.0)

..
...
not showing all lines
....
......
,

我在使用 CryptoSwift pod 时遇到了同样的问题。 Xcode 12.5 使用 Swift 5.4。我认为 CryptoSwift 尚未针对 swift 5.4 进行更新。我切换回 Xcode 12.4 并运行 pod install。它再次在 Xcode 12.4 上构建。最新版本的 CryptoSwift 仅支持 Swift 5.3

更新

我无法使用可可豆荚让 CryptoSwift 更新过去的 1.2.0 版本。我删除了 pod 并将其添加为 Swift 包(版本 1.4.0)。我能够使用 Xcode 12.5 进行构建

Confirmed this was fixed in CryptoSwift 1.3.2

,
  1. 删除旧版本
  2. 重新安装最新版本
,

这是因为 @_specialize 标签在 Swift 5.4(Xcode 12.5) 中发生了变化,您可以通过正则表达式进行替换:

@_specialize\(([^,]+),\s([^)]+)\)
@_specialize\($2\)