I experience a problem where previews of SwiftUI stop working. Only the preview feature fails, I can still run the simulator.
The problem is reported as following:
Task :shared:embedAndSignAppleFrameworkForXcode FAILED
error: /Users/ … .app/Frameworks: Operation
not permittedWhat went wrong:
Execution failed for task ‘:shared:embedAndSignAppleFrameworkForXcode’.
Cannot access output property ‘destDir’ of task ‘:shared:embedAndSignAppleFrameworkForXcode’. Accessing unreadable inputs or outputs is not supported. Declare the task as untracked by using Task.doNotTrackState(). For more information, please refer to https://docs.gradle.org/8.2/userguide/incremental_build.html#disable-state-tracking in the Gradle documentation.
java.nio.file.FileSystemException: /Users/ … .app/Frameworks: Operation not permitted
If I create a project everything works fine, but If I came back later this problem starts to occur.
Next day: Now the Simulator also stopped working and Xcode does not show the error details, just "Failed to create directory ‘…./Frameworks’.
2
Answers
The only thing working at the moment is to recreate the project. Not an elegant solution for sure, hope the problem will be fixed in one of the next updates.
I spent a whole day trying to figure this one out. Thanks to @kojot’s comment above with a link to youtrack I finally got it sorted. For completeness here is the solution:
Disable script sandboxing
Build settings
tabBuild options
look forUser script sandboxing
and set it to No orENABLE_USER_SCRIPT_SANDBOXING = NO;
./gradlew --stop
in your project folder (This is the one I was missing)