objectbox / objectbox-swift

Swift database - fast, simple and lightweight (iOS, macOS)
https://swift.objectbox.io
Apache License 2.0
467 stars 30 forks source link

User script sandboxing breaks with generate_sources.sh #87

Closed colintheshots closed 1 month ago

colintheshots commented 1 month ago

Is there an existing issue?

Build info

Steps to reproduce

  1. Install Cocoapods into app following recommended instructions: add to Podfile, pod install --repo-update
  2. Run setup Ruby script to install Sourcery code gen script
  3. Run project on iOS

Expected behavior

The app builds, running the code gen script.

Actual behavior

The app fails to build with the message "Sandbox: zsh(96617) deny(1) file-read-data ...app/Pods/ObjectBox/Mac/OBXCodeGen.framework/Versions/A/Resources/generate_sources.sh"

Code

No code needed, just a template iOS app.

Logs, stack traces

Logs ```console error: Sandbox: zsh(96617) deny(1) file-read-data ...app/Pods/ObjectBox/Mac/OBXCodeGen.framework/Versions/A/Resources/generate_sources.sh (in target 'App' from project 'app') /bin/zsh: can't open input file: ...app/Pods/ObjectBox/generate_sources.sh ```

Workaround

I've noticed that I can workaround the issue by disabling User Script Sandboxing in Build Settings on the app target. Ideally, this wouldn't be necessary.

If it is necessary, this should be mentioned in the instructions to install the Pod.

rupe120 commented 1 month ago

I am seeing the same

greenrobot-team commented 1 month ago

Thanks for reporting! I guess "User Script Sandboxing" is turned on by default now.

As suggested, we should add a step to the installation instructions to turn this off, or maybe let the setup.rb script do it.

The current workaround is to manually disable "User Script Sandboxing" in Build Settings of the Xcode project.

(For our reference, internal issue objectbox/objectbox-swift#302)

greenrobot-team commented 1 month ago

This is now documented on the Installing ObjectBox page: https://swift.objectbox.io/install#project-settings

(Side note: future versions of the generator may lift this requirement. But it's required right now.)