Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

d0zz0r

macrumors newbie
Original poster
Aug 10, 2021
10
0
I create an application that try to do HTTP Get Request. I do it with call "curl" with "popen()". I log response of curl and get:


"Operation not permitted. Couldn't connect to server"


I know that if i compile binary just from cli - all ok. Problem with C-Obj or XCode or something same. Who know whats problem and how resolve it ?
 
No one is going to be able to help much without knowing a lot more details, for example platform/OS, exactly what you are doing, what you have done so far, maybe a minimal example, etc.
 
Mac OS . I write al, call "curl" with "popen" - things that i wrote, that's all.
 
No one is going to be able to help much without knowing a lot more details, for example platform/OS, exactly what you are doing, what you have done so far, maybe a minimal example, etc.

Generally I agree with you; People should give as much context as they can when asking technical question to take away the guesswork. However in this case I knew exactly what the problem was immediately

I create an application that try to do HTTP Get Request. I do it with call "curl" with "popen()". I log response of curl and get:


"Operation not permitted. Couldn't connect to server"


I know that if i compile binary just from cli - all ok. Problem with C-Obj or XCode or something same. Who know whats problem and how resolve it ?
When you make an app project in Xcode, it sets up your project with sandboxing, which compiling with clang or GCC directly from the CLI won’t. You need to add a “hole” in your sandbox for networking. It’s intentional behaviour for security. If another program finds a way to exploit your program to get arbitrary code execution on the machine inside your program’s execution space, their possibilities will be limited by your sandboxing needs.
There should be a simple checkbox for it in the top level project view, but also this key does it for outgoing request

There’s a similar key for incoming networking called server instead of client
 
Where i should put it ? Can anyone help me plz ?)))) Usually i work for Linux/FreeBSD and from CLI, not from "XCode" or other IDE )))) When i just compile binary on Mac OS - all ok ) Where should i put it ?
 

casperes1996, also, i want ask, if you are developer in Mac, may be you can help me with some points/questions, i ready to pay so $, just i need resolve my quest and that's so problems with OS...​

 
I won't take money for anything, but I'll gladly help.

It should be placed in the file that ends with .entitlements

It's a plist, Xcode has a nice editor for it. You add a row, fill in that entitlement name, set it to boolean and write either YES or 1 in the value field
 
It's work ! Very well ! Thanks much, man ! If it's possible, i will create second subject - check it plz too. What about money, just i want to thanks, no over ) And also if you interested, i have real interesting project for Mac OS, more for thinking then for coding, there story about creating a few concept
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.