Search code examples
boostxcode10.3

How to fix "Operation not permitted" in http_listener


I develop on Mac, and try to signing through Google or Facebook provider. I open browser to do this and open a http listener to listen the result. But it crashes with exception "boost::wrapexcept: bind: Operation not permitted" right after the browser opened

Everything runs ok if I build Xcode project after generated by Cmake, but crashes if I just use Xcode. I've installed cpprestsdk.

_listener = new http_listener(U("http://localhost:8889"));
 _listener->support([this](http::http_request request) {
    //some other code
 });

 _listener->open().wait();//it crashes here

Please help


Solution

  • I found the problem. My app is sandbox app so the folder of app data is ~/Library/Container/.. and it's not allowed to write to that folder. Changing the folder solves problem.