How do I get the Mac OS X Firewall to permanently allow my iOS app?

后端 未结 5 1727
南笙
南笙 2020-12-08 19:10

I\'m writing an iOS app that acts as, among other things, a telnet server. Naturally, it begins listening for connections as soon as it starts.

When I run the app in

5条回答
  •  难免孤独
    2020-12-08 20:02

    So we want to suppress the following dialog

    Do you want the application “NNN.app” to accept incoming network connections?

    which appear on every activation of the Xcode iOS simulator. I believe there is now a solution for that. Basing my answer on this blog.

    Simply run the following commands in a Terminal window:

    #temporarily shut firewall off:
    sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
    
    #put Xcode as an exception:
    /usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Xcode.app/Contents/MacOS/Xcode
    
    #put iOS Simulator as an exception:
    /usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator
    
    #re-enable firewall:
    sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on
    

    For me it worked. Please note simulator address is according to Xcode 8.

提交回复
热议问题