Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"

created at 01-19-2022 views: 4

problem

Recently I wrote a tool for external serial communication, and found that it kept reporting errors when opening the port.

Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"

very surprised..

I remember that my colleague mentioned the mechanism of sandbox before (I won't say that it is because I have been tangled for a long time and can't find the reason =.=), so I found the option disable in setting, and found it. It seems that I am still unfamiliar with the development process and should not be stuck with this problem for so long.

sandbox

The following is an excerpt from the popular science knowledge on the Internet, do some learning:

sandbox

sandbox

Since OSX 10.6, the sandbox mechanism has been introduced, which stipulates that applications published to the Mac AppStore must abide by the sandbox convention. The sandbox has strict restrictions on the system resources, hardware peripherals, files, networks, and XPC accessed by the application, which can prevent malicious apps from attacking the system through system loopholes and gaining control rights, ensuring the security of the OSX system. Sandbox is equivalent to giving each App a separate space. Authorization is required to access resources outside of your own space.

As shown in the figure below, check the set permissions in the project:

settings

Mac
Please log in to leave a comment.