Change the IP Address on iPhone by using code - ios

My app has to connect to a server which can redistribute a new IP Address for the iOS client device.
How to change the IP Address on iPhone by using code in my app?
The app will not be published on the app store and the iOS devices may be jailbroken if necessary.
Anyone can give some suggestion on coding?

You cannot change ip address with the non-private frameworks that you are allowed to use.
You have to find a different architecture for your server-client communication if you want your app to be published on the app store.

From Apple Documentation : iOS is using DHCP(Dynamic Host Configuration Protocol) protocol. So As per DHCP manual IP settings are not allowed by coding.
To learn more about DHCP read This.

Related

Some IOS apps not IPv6 ready?

Apple requires that all apps in the app store to work in an all IPv6 network (no IPv4 network) according to this link
https://developer.apple.com/support/ipv6/
I was sniffing traffic from a few apps on the IOS and I checked to see if their APIs support IPv6 and it turns out that they don't. I checked their URLs on this site
http://ipv6-test.com/validate.php
I'm a bit puzzled about this. Aren't all apps in the Apple App store supposed to support IPv6?
One of the apps that I tested was the Textme app. Here is one of the URLs that they use within their app
https://api.textme-app.com/api/auth-token/
and by the looks of it, that domain does not support IPv6
The app needs to work in an IPv6-only environment with NAT64. That doesn't require the server to support IPv6, it just requires the app to not be bothered if the network pretends that the is reachable over IPv6-only.

Required iPv6 compatibility - rejected by Apple iOS app

I uploaded my app on itunes multiple times and received the following message:
(
We discovered one or more bugs in your app when reviewed on iPhone running iOS 10.2 on Wi-Fi connected to an IPv6 network.
Specifically, when we attempted to create a new account a loading indicator spun indefinitely.
)
Apps are reviewed on an IPv6 network. Please ensure that your app supports IPv6 networks, as IPv6 compatibility is required.
Notes: I have used AFNetworking version 3.1.0 for call web services(support IPV6) and Apple Reachability(also support IPV6) without using hard coded Ip.
My question: the changes must be done on mobile side or server side?
As far as my experience with IPv6 reaches, you're probably right. When you develop your app in Xcode using the latest SDK for iOS 10.2, you should be save with IPv6 compatibility on your app's side.
However, Unix (MacOS audios are a Unix derivative) takes the path or url from your app and will negotiate at the OS level with the other side you want to connect with. This usually runs over a DNS. So, your app and iOS will first request an IPv6 IP address from the DNS. When the DNS understands IPv6, which is not always guaranteed, but it usually does, it asks the other side for an IPv6 address. If the other side does not support IPv6, the operating system will request an IPv4 address and set up the connection.
Since Apple will hold you responsible for the entire chain of services delivered by your app, you must ensure the requested side also supports IPv6 via it is part of the your apps functionality.
Hope this helps.

App rejected because of ipv6 network connectivity issues

The reason to reject my app is ipv6 network connectivity issues.
First, I am using AWS as my backend server. I use my domain name to connect with my server like http://ec2-XX-XXX-XXX-XXX.compute-1.amazonaws.com:80/parse where X is a number
Second, I tried to reproduce the issue by
a) Go to my iPhone setting -> Developer -> Status (Newwork link conditioner) -> create a profile that exactly same as LTE but the Protocol is IPv6
b) Do the same thing as Apple suggest. Use the thunderbolt ethernet to connect my MacBook and share wifi with my iPhone.
My app works in both cases.
Third, I take a look on AWS about supporting IPv6. Here is the link. http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html#AAAAFormat It seems nothing should be changed. I am not quite sure because I am not familiar with server.
Any suggestions? Thanks.
UPDATE
If you are using old apple's Rechability class and if you are using old AFNetworking's AFNetworkReachabilityManager class
Response - I did not implement any code for Reachability or AFNetworking. Should I worry about those classes are inside other sources' Frameworks like Parse?
If you are using hard coded IP addresses
Response: My domain name is http://ec2-XX-XXX-XXX-XXX.compute-1.amazonaws.com:80/parse where X is a number. So, I think this should be fine.
there are few points that frequently cause this issue.
If you are using old apple's Rechability class then replace it with latest one because old Rechability class is not compatible with `ipv6 only network.
Same for old AfNetworking library, if you are using old AFNetworking's AFNetworkReachabilityManager class then replace this class with latest AFNetworkReachabilityManager class or replace whole library with latest one
If you are using hard coded IP addresses as api then replace it with domain name. For example you should not use api like : http://192.168.1.11:4444/login. Your api should be like : http://api.example.com/login
As Apple document states,
Make sure you aren’t passing IPv4 address literals in dot notation to
APIs such as getaddrinfo and SCNetworkReachabilityCreateWithName.
Instead, use high-level network frameworks and address-agnostic
versions of APIs, such as getaddrinfo and getnameinfo, and pass them
hostnames or fully qualified domain names (FQDNs). See getaddrinfo(3)
Mac OS X Developer Tools Manual Page and getnameinfo(3) Mac OS X
Developer Tools Manual Page.
Note: In iOS 9 and OS X 10.11 and later, NSURLSession and CFNetwork
automatically synthesize IPv6 addresses from IPv4 literals locally on
devices operating on DNS64/NAT64 networks. However, you should still
work to rid your code of IP address literals
And your api hosting server should compatible with ipv6 (this is not major concern because almost server are compatible with ipv6)
You can refer Apple documentation for more details
You will come to know that how you can create ipv6 only network on your mac for testing also by above apple documentation!
My app is approved.
The only thing I change is
set the signing to "automatically managing signing" because my app fails to run when I change the build configuration to "Release" (I am not sure is this related to IPv6. I think it is kind of strange)
Reference for other people who use Google Map api, Parse hosting in AWS and Facebook login:
I think their frameworks are good to pass IPv6 requirement.
I am still questioning why Apple said my app fail to pass the IPv6 requirement in my last submission.

iOS socket list of hosts wlan

I have some WLAN-Device, that I communicate with.
At first I go to IOS Settings and connect to the device directly.
Then in my App I need to input the ip and port to open a socket.
Until now I knew the IP and Port, to open a socket connection to this device.
But if I am already connected (Adhoc) to the device, why I can not find this stuff automatically?
I already saw some solutions, but most of them need the usage of dynamic libs or just not longer available in iOS7.1. I can not use dynamic libs, because this App should go to AppStore.
There is no other way since iOS 6.
You have to scan the location. "Reachability" could help you, if you know the name of the host. Also you could try to scan the posible IP's. With Thread limited by 5 Operations it could go preaty fast.

Configure iPad IP address programmatically

I have a requirement where the iPad application must configure the IP address of the device to a particular IP and connect to a wireless network. I had gone through the internet but could not find any material regarding the possible solution .
I really appreciate any solution on this
Thank you
Unfortunately, an iOS app doesn't have this control over the system, so this can't be done on an App Store app.

Resources