Realm-Swift CocoaPod 导入后出现未知属性“class”

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

我是 Xcode 和 Swift 的新手。今天我用 swift 启动了一个空白的选项卡式应用程序,名为“测试”。我可以构建空白项目,但一旦我尝试通过 CocoaPod 添加 Realm,它就不再构建了。

Error: Unknown property attribute 'class'
File: Test/Pods/Realm/Realm/RLMSyncSession.mm:73:12:
CocoaPod version: 1.2.0
Xcode version: Version 7.3.1 
Realm: 2.4.3

我做了 pod 初始化/更新/安装 Pod文件:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'Test' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Test
  pod 'RealmSwift'

  target 'TestTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

安装后,我打开“Test.xcworkspace”文件并尝试构建项目,但失败了。如何解决这个问题?

ios swift cocoapods realm
2个回答
1
投票

该问题来自过时的 Xcode 版本。

这会导致 OP 在将 Realm 添加到项目后无法实现其构建和 Cocoapods 设置。

按照评论中的建议更新到最新版本(我想是8.2.1)后,pod机制起作用了,最终可以实现构建。


0
投票

只需让你的 iOS 开发目标达到 15.0 及以上, Pod 15.0 及以上

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