编译Ionic应用程序时未设置PODS_ROOT和其他Pod Env变量 [英] PODS_ROOT and other pods env variables not set when compiling Ionic app

查看:210
本文介绍了编译Ionic应用程序时未设置PODS_ROOT和其他Pod Env变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了一个使用对讲机(第三方扩展)的Ionic 2应用程序。对讲机是使用cocoapods安装的。

I have built an Ionic 2 app which uses Intercom (a third-party extension). Intercom is installed using cocoapods.

在编译我的应用程序时,出现错误:

When compiling my app I am given the errors:

diff: /Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

这是由构建阶段 [CP] Check Pods Manifest生成的。锁定

diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [ $? != 0 ] ; then
    # print error to STDERR
    echo "error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation." >&2
    exit 1
fi
# This output is used by Xcode 'outputs' to avoid re-running this script phase.
echo "SUCCESS" > "${SCRIPT_OUTPUT_FILE_0}"

我尝试输出环境变量 PODS_PODFILE_DIR_PATH PODS_ROOT STDERROR echo 在上面的脚本中,两者均为空白。我可能可以通过自己修改这些路径来解决此特定错误,但显然其他更根本的问题已损坏,因此我需要自行解决实际问题。

I have tried outputting the environment variables PODS_PODFILE_DIR_PATH and PODS_ROOT in the STDERROR echo from the script above and both are blank. I can probably get around this specific error by amending those paths myself, but clearly something else more fundamental is broken, so I need to fix the actual issue itself.

为什么要这些变量是否为空白?

Why are these variables blank?

我还有 [CP] Copy Pods Resources [CP]嵌入Pod框架,该框架运行一些shell脚本。我尝试过更改它们的顺序,但是没有运气。

I have additional build phases for [CP] Copy Pods Resources and [CP] Embed Pods Frameworks which run some shell scripts. I have tried changing the order of these with no luck.

我的Podfile.lock和Podfile(无论如何都是自动生成的)都不错:

My Podfile.lock and Podfile (which was auto-generated anyway) both seem good:

Podfile:

# DO NOT MODIFY -- auto-generated by Apache Cordova
platform :ios, '8.0'
target 'niix' do
    project 'niix.xcodeproj'
    pod 'Intercom', '~> 3.2.2'
end

Podfile.lock:

Podfile.lock:

PODS:
  - Intercom (3.2.12)

DEPENDENCIES:
  - Intercom (~> 3.2.2)

SPEC CHECKSUMS:
  Intercom: 3119e8ebf76d3da425bab717a08067398fcabfe6

PODFILE CHECKSUM: f99283bb8a4e56cb037a02390d2fbc4e76c97db9

COCOAPODS: 1.3.1

运行 pod install 和所有文件都没有错误我希望已经存在。

There are no errors when running pod install, and all files I expect are present.

我已经尝试过的事情:


  • 运行 pod安装(当然)

  • 运行 pod解整合,运行产品>清理在XCode中,重新运行 pod安装

  • 手动删除 Podfile.lock Pods 目录,在XCode中运行Clean,然后重新运行 pod install

  • 睡个好觉,第二天早上再尝试一次!

  • Running pod install (of course)
  • Running pod deintegrate, running Product > Clean in XCode, re-running pod install
  • Manually deleting the Podfile.lock and Pods directory, running a Clean in XCode and then re-running pod install
  • A good nights sleep and another attempt the next morning!

注意事项:


  • 我从 project.xcworkspace 运行 project.xcodeproj

  • 我正在运行最新的XCode 8.3.3稳定版本

  • 我正在运行最新版本的Cocoapods 1.3.1

  • I am running from project.xcworkspace not project.xcodeproj
  • I am running the latest stable version of XCode 8.3.3
  • I am running the latest version of Cocoapods 1.3.1

推荐答案

我花了很长时间时间试图解决这个问题,却一无所获。该应用程序是使用Ionic 2构建的,因此实际的源代码存储在其他位置,并内置在本机XCode应用程序中。

I've spent a long time trying to work this out and got nowhere. The app was built using Ionic 2, so the actual source code is stored elsewhere and built into a native XCode application.

因此,我决定删除整个XCode目录。 .xcodeproj .xcworkspace 等。然后,我从Ionic重建。

Because of this I decided to delete the entire XCode directory. .xcodeproj, .xcworkspace, everything. I then rebuilt from Ionic.

在第二个版本中,我看到多数民众赞成在 Pods 目录,并且一切如它应该是。我可以编译并首次运行而没有任何问题。

On the second build I saw thats the Pods directory was there and everything was as it should be. I could compile and run first time without any issue.

我的假设是第一次构建失败是因为我没有安装Cocoapods,所以Ionic默默地无法运行设置后, pod install 命令。我想它的功能与传统设置有些不同,这就是为什么我之后不能只运行 pod install 的原因。

My assumption is that the first build failed because I didn't have Cocoapods installed, so Ionic silently failed to run the pod install command upon set up. I guess it does something a little different to a traditional setup which is why I couldn't just run pod install afterwards.

因此,简而言之,此问题已通过删除iOS项目得以解决:

So, in short, this was fixed by removing the iOS project:

ionic cordova platform rm ios

并重新添加:

ionic cordova platform add ios

然后构建:

ionic cordova run ios --device

但是请确保先在系统上安装了Cocoapods。

But make sure you already have Cocoapods installed on your system first.

这篇关于编译Ionic应用程序时未设置PODS_ROOT和其他Pod Env变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆