I am following the steps stated at this link: Build on iOS to integrate and use Mobile Payment SDK in an iOS app. After completing every step when I try to compile the build on an iPhone device it prints this error message:
error: Sandbox: bash(17723) deny(1) file-read-data /Users/quantum/Library/Developer/Xcode/DerivedData/MobilePayment-gmrpxlmgxjbgcpfghczqofajdkpf/Build/Products/Debug-iphoneos/MobilePayment.app/Frameworks/SquareMobilePaymentsSDK.framework/setup (in target ‘MobilePayment’ from project ‘MobilePayment’)
/bin/bash: /Users/quantum/Library/Developer/Xcode/DerivedData/MobilePayment-gmrpxlmgxjbgcpfghczqofajdkpf/Build/Products/Debug-iphoneos/MobilePayment.app/Frameworks/SquareMobilePaymentsSDK.framework/setup: Operation not permitted
Am I missing anything over here?
Looks like your running into a bash
process that is being denied permission to read a specific file during your Xcode build. Have you tried:
- Check File Permissions:
- Ensure that the file and its containing directories have the correct read permissions.
chmod -R 755 /Users/quantum/Library/Developer/Xcode/DerivedData/MobilePayment-gmrpxlmgxjbgcpfghczqofajdkpf/Build/Products/Debug-iphoneos/MobilePayment.app/Frameworks/SquareMobilePaymentsSDK.framework
- Verify File Existence:
- Make sure that the file
/setup
actually exists in the specified directory.
ls /Users/quantum/Library/Developer/Xcode/DerivedData/MobilePayment-gmrpxlmgxjbgcpfghczqofajdkpf/Build/Products/Debug-iphoneos/MobilePayment.app/Frameworks/SquareMobilePaymentsSDK.framework
- Code Signing:
- Ensure that the framework and your app are properly signed. Go to your Xcode project settings and check the “Code Signing” section.
- Re-sign the framework if necessary.
- Update Build Phases:
- Check your build phases in Xcode to ensure that any scripts or commands that access this file are correctly configured.
- If you have a “Run Script” phase that accesses this file, make sure it has the correct permissions and paths.
- Disable System Integrity Protection (SIP) (Not Recommended for Production):
- If you’re running into this issue on a development machine, you might temporarily disable SIP to see if it resolves the issue. This is not recommended for production environments.
- To disable SIP:
- Restart your Mac and hold down
Command + R
to enter Recovery Mode.
- Open Terminal from the Utilities menu.
- Run the command:
csrutil disable
.
- Restart your Mac.
- After testing, you can re-enable SIP by following the same steps and running
csrutil enable
.
- Check Sandbox Entitlements:
- Ensure that your app’s entitlements are correctly configured if you’re using app sandboxing.
- Open your
.entitlements
file and make sure it includes any necessary permissions.
What did not work for me:
- Check File Permissions:
It was showing appropriate permissions. Also whenever derived data is cleaned due to any action old path and its permissions would not be valid
- Verify File Existence:
Yes it does exist
- Code Signing:
Currently the Square recommended way to integrate the framework is through swift package manager or cocoapods. None of these show the actual framework in XCode where we can check the code signing panel.
- Update Build Phases:
The script as stated in the documentation was correctly configured with default options.
- Disable System Integrity Protection (SIP):
No way for us
- Check Sandbox Entitlements:
All good.
What worked for me:
XCode > Target > Build Settings > Build Options > User Script Sandboxing : NO
Yes it worked for me ( User Script Sandboxing : NO)