title: PODS_ROOT and other pods env variables not set when compiling Ionic app
body: <p>I have built an Ionic 2 app which uses Intercom (a third-party extension).  Intercom is installed using cocoapods.</p>
  
  <p>When compiling my app I am given the errors:</p>
  
  <pre><code>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.
  </code></pre>
  
  <p>This is being generated by the Build Phase <code>[CP] Check Pods Manifest.lock</code>:</p>
  
  <pre><code>diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" &gt; /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." &gt;&amp;2
      exit 1
  fi
  # This output is used by Xcode 'outputs' to avoid re-running this script phase.
  echo "SUCCESS" &gt; "${SCRIPT_OUTPUT_FILE_0}"
  </code></pre>
  
  <p>I have tried outputting the environment variables <code>PODS_PODFILE_DIR_PATH</code> and <code>PODS_ROOT</code> in the <code>STDERROR</code> <code>echo</code> 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.</p>
  
  <p>Why are these variables blank?</p>
  
  <p>I have additional build phases for <code>[CP] Copy Pods Resources</code> and <code>[CP] Embed Pods Frameworks</code> which run some shell scripts.  I have tried changing the order of these with no luck.</p>
  
  <p>My Podfile.lock and Podfile (which was auto-generated anyway) both seem good:</p>
  
  <p>Podfile:</p>
  
  <pre><code># DO NOT MODIFY -- auto-generated by Apache Cordova
  platform :ios, '8.0'
  target 'niix' do
      project 'niix.xcodeproj'
      pod 'Intercom', '~&gt; 3.2.2'
  end
  </code></pre>
  
  <p>Podfile.lock:</p>
  
  <pre><code>PODS:
    - Intercom (3.2.12)
  
  DEPENDENCIES:
    - Intercom (~&gt; 3.2.2)
  
  SPEC CHECKSUMS:
    Intercom: 3119e8ebf76d3da425bab717a08067398fcabfe6
  
  PODFILE CHECKSUM: f99283bb8a4e56cb037a02390d2fbc4e76c97db9
  
  COCOAPODS: 1.3.1
  </code></pre>
  
  <p>There are no errors when running <code>pod install</code>, and all files I expect are present.</p>
  
  <p>Things I have tried already:</p>
  
  <ul>
  <li>Running <code>pod install</code> (of course)</li>
  <li>Running <code>pod deintegrate</code>, running Product > Clean in XCode, re-running <code>pod install</code></li>
  <li>Manually deleting the <code>Podfile.lock</code> and <code>Pods</code> directory, running a Clean in XCode and then re-running <code>pod install</code></li>
  <li>A good nights sleep and another attempt the next morning!</li>
  </ul>
  
  <p>Things to note:</p>
  
  <ul>
  <li>I am running from <code>project.xcworkspace</code> not <code>project.xcodeproj</code></li>
  <li>I am running the latest stable version of XCode 8.3.3</li>
  <li>I am running the latest version of Cocoapods 1.3.1</li>
  </ul>