Sandboxing issue in Xcode Run Script Phase - ios

I have a swift script that reads some files to run some checks on them but I get an error that states: Error Domain=NSCocoaErrorDomain Code=257 “The file “Extensions” couldn’t be opened because you don’t have permission to view it.”
The file exists and has standard permissions, all that has changed is that the script has been compiled on macOS 10.14 instead of macOS 10.13. Also the sandboxing entitlement is not applied to it. Is there any known issue with sandboxing when running a script from a Run Script build phase?
If I simply cat the Extensions file, then it prints the contents out in the log correctly.

Change read/write access to the particular folder.
Please follow this link
macOS User Guide (Apple) -> Change permissions for files, folders or disks on Mac
Or try this
You might try looking in SystemPreferences > Security&Privacy > Privacy tab. From there, scroll down to "Files and Folders" <-- There's where you can see programs and the folders they have been granted access to in Catalina.
Personally, I didn't have time to waste figuring out how the new file permissions are supposed to work, so I let Xcode have full disk permission. (Right above the "files and folders" is "Full Disk Access".

Related

Firebase Crashlytics with Swift Package Manager - crash because of wrong path

I have installed Firebase through the Swift Package Manager for my iOS project, including Crashlytics. I have followed these instructions and added the required script to build phases:
https://firebase.google.com/docs/crashlytics/get-started?platform=ios
So the path for execution is:
"${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run"
On start up (iPhone simulator), the app crashes with the following error message:
/Users/[path-to-my-project]/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run: No such file or directory Command PhaseScriptExecution failed with a nonzero exit code
I don't understand why it tries to find the crashlytics script in my Xcode project folder and not in the derived data folder at runtime.
I checked the derived data folder and followed the path. Indeed, the Crashlytics run script is at the expected path.
thanks for any hints in the right direction
In the meantime I've found out that the path to the build folder is set globally in the Xcode preferences. For some reason I don't recall, my build folder has always been in my project folder for all projects I ever worked on in Xcode... I know this for sure because I always add the build folder to .gitignore.
To change the build folder to be a subfolder of your project's derived data folder, go to:
Xcode -> Preferences -> Locations -> Advanced and select the first option.
Firebase assumes that this option is selected by default (maybe it is and I'm the weirdo...).

Xcode file permission issue

I updated my MacOS to Catalina, after that I am getting error reading issue in one project only. Check below image
When I try to open the file in my xcode, I got below error.
If I opened the same file from finder, then it opens the same file in xcode successfully. And issue is shifted to other file. I tried 7-8 times and it continuously coming from one file to another.
Already tried
Open backup project and still getting same issue.
Tried with changing the folder directory, like copied project to desktop, but still getting issue
Cleaned and build the project,
Restart my mac.
Note: I am getting issue in one project and rest of my projects are working file.
Is there any one time solution for this issue?
This error message can occur (somewhat misleadingly) if Xcode does not have permissions to access your Documents folder, and your project references a file that is not located within the same folder path as the project file.
The error message is misleading because the issue is not "you" (a user) lacking permission to view the file. The issue is that Xcode doesn't have permission to access the location of the file.
To resolve, go to System Preferences, Security & Privacy, Files and Folders, and enable Xcode to access the Documents folder. (Current as of MacOS 10.15.4 and Xcode 11.4.1)
You can change the permission from the Finder, right click on that file, goto info and then on bottom under sharing and permission change the privilege to read and write against your username. This might solve your issue.
Try changing the permission if not already done.
Enter the following in your terminal:
sudo chmod -R 777 /Users/macmini1/Desktop/Classes
It will ask for your password and then you will good to go.

React Native - launchPackager.command cant be opened

I am having trouble building react native ios project.
Error message:
"launchPackage command" can't be opened because it is from an unidentified developer.
Any idea how to fix this?
Although this answer will most likely work, you would also allow all future apps from unidentified developers to be installed without being prompted.
To allow executing only the command in question (launchPackager.command), go to your react-native installation folder (most likely node_modules/react-native/scripts) in Finder and right-click launchPackager.command, choose Open and confirm by clicking Open again.
You will not be prompted again for this command as you have allowed execution specifically.
Another simple way is to delete node_modules folder from project directory and do npm install.
This happened because project was copied from old mac which had node_modules folder created by that old mac user, hence some problem occurs for project transferred to new mac.
Had the same problem on macOS Mojave.
This helped:
chmod 777 node_modules/react-native/scripts/launchPackager.command
on MacOS Catalina and above
Go to
System Preferences
Security & Privacy
Choose tab "Privacy"
Select "Developer Tools" on left pane
Check "Terminal" to allow terminal to run software locally which does not meet system's security policy . (please be aware of potential implications of this action and make sure that you know what you are doing )
Go to
System Preferences
Security & Privacy
Choose tab General
Choose Allow apps downloaded from anywhere or Allow apps downloaded from App Store and identified developers
I had the same error with you and this method worked for me.
chmod 777 node_modules/react-native/scripts/launchPackager.command
open terminal and Run the above command
after that Run the react-native run-android
Works for Me, It will Run :)
The reason is because you downloaded source code using virtual machine.
Solution:
Please download source code at your real machine.
And then copy it at VM, and build this project.

updated AIR SDK from 23 to 25 and i get error Error: Unable to access jarfile /../lib/mxmlc-cli.jar

I have just updated my AIR SDK from version 23 to 25.
When running the command mxmlc, the following error occurs:
Error: Unable to access jarfile /../lib/mxmlc-cli.jar
Solution 1:
Make sure you have downloaded the Flex SDK and not the AIR SDK.
In the download page, there's link specifying:
Flex users will need to download the original AIR SDK without the new compiler.
Solution 2:
When the Adobe AIR SDK is installed it is sometimes installing files with wrong permissions.
The mxmlc-cli.jar file your lib directory probably has a permissions issue.
Try giving this file full permission and making sure it's not read only and everything should work fine.
If you are using Windows, just right click the files and set up the proper permissions in the security tab, and make sure the file is not read only.
If you are using Unix / Linux, run the following:
$ su -
# cd [AIRSDK install directory]
# chmod -R go+rx *
If you are using Mac OS:
Click the mxmlc-cli.jar file or to select it.
From the File menu, select Get Info. One of the windows shown below
appears. Click the disclosure triangle next to Sharing & Permissions
to display the file's permissions.
Click the lock and authenticate with an administrator account. Use
the menus next to users and groups to change the permissions.
This is an old one, but I've faced this problem several times and the fix is really minor.
You have to edit mxmlc or compile.
In the file there is a row which should be changed to:
SCRIPT_HOME=`dirname "$0"`
The error comes from missing " " around the $0.

What's wrong with a new playground file?

Just create a new playground file, got this without doing anything
failed to launch process. The folder "disabled.plist" doesn't exist.
Quit Xcode and restart, even remove 'Xcode/DerivedData', doesn't have any help.
How could fix it?
I had the same issue and I just fixed it.
Turns out somehow I was removed from having permission to write to /private/temp directory.
To solve it:
Using CMD
Update the permission of your temp folder using:
sudo chown -R $(whoami) /private/temp
Repairing with Disk Utility
If you are using OS X 10.10 ("Yosemite") or earlier,
Try to fix the problem by using the OS X Disk Utility program:
Launch Disk Utility. It is located in /Applications/Utilities.
Select the computer's boot volume (usually "Macintosh HD") in the left column.
Click on the "Repair Disk Permissions" button".
Wait until the permissions repair is complete (it usually takes several minutes).
Quit Disk Utility.
Launch Xcode and to see if the problem has been fixed.
Hope it helps someone

Resources