I want to track iOS device's Ip address and submit it to server for fraud detection purpose.
This seems like a bad idea. iOS devices have multiple network interfaces and, in most cases, these network interfaces have multiple addresses which can change frequently (for IPv6) and can be shared between users (IPv4 with NAT). For example:
My iOS device at home has two working interfaces:
My iOS device on the road just has WWAN. My cellular provider currently hands out NATed IPv4 addresses, where one address is shared between different devices from different customers. Other cellular providers use DNS64/NAT64, and thus the device has no IPv4 address at all.
It’s common for organisations to also use NAT on their internal networks, meaning that a single public IPv4 address could potentially be used by anyone in that organisation.
It’s also common to see multiple levels of NAT. For example, if you have a WWAN-to-Wi-Fi gateway, there’s two levels of NAT (one on the gateway, one implemented by the cellular provider).
Trying to turn all of the above into a useful metric for fraud prevention is going to be challenging.
Regardless…
1. In iOS 12 using swift language, can we access device ip address without any restriction?
Yes.
2. Whether apple allowed to track device ip address
This seems like a duplicate of question 3.
is there any public API provided by apple to track device ip address?
There are APIs to get IP address information (for example,
getifaddrs
) but that’s not the same as
tracking it (I’m not even sure what you mean by “tracking” at the API level).
Keep in mind that local APIs only know about local IP addresses. If you want to discover the public IP address, you’ll need to implement that yourself, being cognisant that there may be multiple levels of NAT.
3. if we track device IP address wther apple reject app on appstore?
I don’t work for App Review and thus can’t answer questions about their policies.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"