Is there a way to pretend IP address in Xcode Device Simulator?

Hi Apple Developers,

I am integrating a 3rd SDK into my app, and this SDK is expected to behave differently if the device is in Europe. However, I am not in Europe, such that I cannot directly test its behaviour in Europe.

This SDK decides the device location by IP address, so I think if there is a way to assign a "pretend" IP address to the simulated iPhones in Xcode device simulator, then I should be able to see how the app behaves.

Do you know any way to do that?

Thank you!

Some detail information: the 3rd party SDK I tried to test with is MoPub SDK. Its GDPR consent part uses the IP address. As shown in the screenshot below. I also have tried "pretend" location through schema editing from Xcode. The location was altered in the simulated device but I still cannot see the GDPR consent message since IP address is not changed.

Answered by Claude31 in 687481022

IP address is the Mac (computer) address: 

h t t p s : / / stackoverflow.com/questions/2606771/what-is-the-iphone-simulator-ip-address/4013086       

There is no wifi settings in simulator

h t t p s : / / w w w .startech.com/en-us/faq/networking-ip-change-ios

Accepted Answer

IP address is the Mac (computer) address: 

h t t p s : / / stackoverflow.com/questions/2606771/what-is-the-iphone-simulator-ip-address/4013086       

There is no wifi settings in simulator

h t t p s : / / w w w .startech.com/en-us/faq/networking-ip-change-ios

Thank you Claude! I changed the IP address of my Mac manually for testing the app. Even though I didn't get the expected result (seeing the popup message), but I think your answer has got to the bottom of the specific question I asked.

I changed the IP address of my Mac manually

Another option here is to subscribe to one of the many VPN services out there that support the Mac and offer worldwide egress points. As the simulator use’s the Mac’s native network stack, that should be sufficient.

You should also file a bug against the third-party SDK requesting that they offer a way to override this in debug builds (via an environment variable, say).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Is there a way to pretend IP address in Xcode Device Simulator?
 
 
Q