link_stat failed: No such file or directory (2) for pods that were working earlier. 

Introduction: When working with iOS projects and their dependencies, symlinks can sometimes cause issues. In this blog, we will explore a simple modification in the “Pods-Runner-frameworks.sh” script to ensure proper symlink resolution.

Issue: Sometimes, while working on an iOS project, you might encounter issues with symlinked files and their resolution. This can cause problems during the build process, especially when the symlinks point to nested symlinked files.

Solution:
To solve this issue, you can modify the “ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh” script in your project to resolve symlinks properly. Here’s how:

Open the “ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh” file in your preferred text editor.

Locate the following block of code:

if [ -L "${source}" ]; then
  echo "Symlinked..."
  source="$(readlink "${source}")"
fi

Modify the code to:

if [ -L "${source}" ]; then
  echo "Symlinked..."
  source="$(readlink -f "${source}")"
fi

Explanation: The change here lies in the use of the -f flag with the readlink command.

  • Original code: readlink "${source}" returns the target of the symlink but doesn’t resolve the entire path if the target itself contains other symlinks.
  • Modified code: readlink -f "${source}" resolves the entire path, following all symlinks until the final, actual file is reached.

By using the -f flag, you ensure that the source variable contains the fully resolved path to the target file, even if it contains multiple nested symlinks.

Conclusion: This simple modification can help you avoid potential build issues in your iOS project caused by symlink resolution problems. By ensuring the full resolution of symlinks, you can improve the reliability of your build process and focus on developing your app.


EDIT:

To permanently fix that, do this in ios/App/App folder if you are in the Ionic app:

sudo gem install cocoapods
pod install