Patrick
Patrick

Reputation: 467

Sandbox: bash(2538) deny(1) file-read-data /Users/.../ios/App/Pods/Target Support Files/Pods-App/Pods-App-frameworks.sh

I'm working on an Ionic iOS project and since I upgraded to macOS Sonoma 14.4.1 I get this error when I try to build my project in xcode 15.3.

I tried

If I set User Script Sandboxing to No, the application builds, but I still get the error when I'm building the exact same commit/version on Ionic Appflow, which I have to do to publish the Application in the App Store.

Upvotes: 0

Views: 2117

Answers (2)

Amr Angry
Amr Angry

Reputation: 3851

Run Script Phase in Xcode to Update ENABLE_USER_SCRIPT_SANDBOXING

Steps to Add a Run Script in Xcode

  • Open your Xcode project.

  • Select your Target from the Project Navigator.

  • Go to the Build Phases tab.

  • Click the + button in the top-left corner and select New Run Script Phase.

  • Rename the script phase (e.g., "Update User Script Sandboxing").

  • Paste the following script into the Run Script text box:

     # Check if ENABLE_USER_SCRIPT_SANDBOXING is YES
      # Extract the project name dynamically from the PROJECT_DIR
      project_name=$(basename "${PROJECT_DIR}") # aka <iStarWars>
    
      # Check if ENABLE_USER_SCRIPT_SANDBOXING is YES
      current_value=$(plutil -extract 'buildSettings' xml1 -o - "${PROJECT_DIR}/${project_name}.xcodeproj/project.pbxproj" | grep "ENABLE_USER_SCRIPT_SANDBOXING" | cut -d "=" -f 2 | tr -d '[:space:]')
    
      if [ "$current_value" == "YES" ]; then
          # Change it to NO
          plutil -replace 'buildSettings.ENABLE_USER_SCRIPT_SANDBOXING' -string "NO" "${PROJECT_DIR}/${project_name}.xcodeproj/project.pbxproj"
          echo "Disabling user script sandboxing"
      fi
    

Upvotes: 0

Patrick
Patrick

Reputation: 467

I managed to get it to build by changing User Script Sandboxing to No on both, the target and the app.

Upvotes: 6

Related Questions