hi can you please tell me how to access iOS device ip address using xamarin. we are building iOS app in which we want to show device local ip address. I used many other solutions but they didnt work for me.
Asked
Active
Viewed 2,933 times
1
-
hello guys it work for me https://stackoverflow.com/questions/17843925/get-ip-address-on-monotouch-xamarin-in-iphone-via-linq dont forget to vote him. – Theappmedia Jul 04 '17 at 12:08
-
Possible duplicate of [Get IP Address on Monotouch/Xamarin in iphone via linq](https://stackoverflow.com/questions/17843925/get-ip-address-on-monotouch-xamarin-in-iphone-via-linq) – DaveP Jul 04 '17 at 12:22
1 Answers
1
I found a post about it here: https://forums.xamarin.com/discussion/348/acquire-device-ip-addresses-monotouch-since-ios6-0
it goes as follow: Try using System.Net.NetworkInformation.NetworkInterface:
foreach (var netInterface in NetworkInterface.GetAllNetworkInterfaces()) {
if (netInterface.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ||
netInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet) {
foreach (var addrInfo in netInterface.GetIPProperties().UnicastAddresses) {
if (addrInfo.Address.AddressFamily == AddressFamily.InterNetwork) {
var ipAddress = addrInfo.Address;
// use ipAddress as needed ...
}
}
}
}

Jordy Dieltjens
- 1,528
- 11
- 29
-
thanks for quick reaponse we alreadu tried this but it doesnt work for us. – Theappmedia Jul 04 '17 at 11:51
-
Did you get an error ? you also need permissions to acces this interface I think? – Jordy Dieltjens Jul 04 '17 at 11:53