diff --git a/getgateway.c b/getgateway.c
index d05bc5e..33b8c45 100644
--- a/getgateway.c
+++ b/getgateway.c
@@ -56,10 +56,16 @@ POSSIBILITY OF SUCH DAMAGE.
 #endif
 
 #ifdef __APPLE__
+#include <TargetConditionals.h>
 #undef USE_PROC_NET_ROUTE
 #undef USE_SOCKET_ROUTE
+#if defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR)
+// iOS or Simulator: Do not use SYSCTL_NET_ROUTE
+#undef USE_SYSCTL_NET_ROUTE
+#else
 #define USE_SYSCTL_NET_ROUTE
 #endif
+#endif
 
 #if (defined(sun) && defined(__SVR4))
 #undef USE_PROC_NET_ROUTE
