首页 > 解决方案 > 无法使用 CocoaPods 安装领域

问题描述

我做了 pod init 并在 Podfile 中编写了 RealmSwift。

我正在使用 Swift5、Xcode 11.3.1、cocoaPod 1.9.1、ruby 2.3.0

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

 target 'project' do
   # Comment the next line if you don't want to use dynamic frameworks
   use_frameworks!

   # Pods for project
   pod 'RealmSwift'

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

   target 'projectUITests' do
     # Pods for testing
   end

end

我得到了这样的 JSON parserError

JSON::ParserError - A JSON text must at least contain two octets!

我应该怎么做才能修复 ParseError?我可以安装 SwiftDate。我不能只安装 RealmSwift。

标签: iosswiftcocoapods

解决方案


遵循这些

  • rm -rf "${HOME}/Library/Caches/CocoaPods"
  • rm -rf "密码/Pods/"
  • 吊舱更新

请在运行“rm”命令之前备份相应的目录

如果不起作用,请删除 Podfile.lock 并运行 rm 命令,然后运行 ​​pod init 和 pod install


推荐阅读