My question in a nutshell: Is there a way to create an iOS app running on an iOS device that can connect to and communicate with its own device's lockdownd?
(For the curious who want to know "the why": I would like to use the connection to lockdownd to trigger the installation of apps in .ipa files on the iOS device that have a "local provisioning profile", i.e. a provisioning profile with the flag LocalProvision set to true which means that over-the-air/OTA installations via a web-based installation are prevented by the operating system.)
A little background: You can connect to an iOS device's lockdownd from a second device either
by letting the second device serve as a USB host for the iOS device or
by establishing a wifi-based TCP connection to the iOS device on port 62078.
By using libraries like libimobiledevice, you can then interact with the iOS device - for example to trigger the installation of an app contained in an .ipa file.
What I have already researched & tried:
According to Jon Gabilondo's very good article Understanding usbmux and the iOS lockdown service, lockdownd creates a UNIX domain socket at /var/run/lockdown.sock - unfortunatley however with "privileges 511, which means only root will be able to write to it." (Quote from the article) --> I have therefore not tried accessing/writing to this socket.
lockdownd also opens a TCP endpoint listening on port 62078 in the device's wifi network. --> I have created a small test app that tries to establish a TCP connection to 127.0.0.1:62078. Unfortunatley, the connection attempt fails with the error #1 "Operation not permitted". Same when trying to connect to the IPv4 assigned by the wifi's DHCP server to the iOS device.
What other option could be used to establish a connection to an iOS device's lockdownd from within an app running on that device?
Related
For the purposes of a presentation demoing our app, where internet is not available, I need to connect some iPhones and iPads to a local wireless network (an ad hoc network) from which they will access a local web-server (hosted on a macbook) to send / receive data.
In the past this was simple, but it seems iOS 10 is no longer happy connecting to wireless networks that don't allow it to access apple's own servers via the internet.
As a test, I am able to use MAMP Viewer to view my local sites when both my laptop and iPhone are connected to wifi with internet access, but not when both are connected to an ad hoc network created via the macbook. I can see that the host exists, but can't connect to it - MAMP Viewer reports an error (with no details).
Is there a workaround, or is it genuinely the case that iOS 10 devices can only use a wifi network for web data if there's an internet connection back to Apple? Hopefully I'm missing something obvious?
I was able to get the connection working using an encrypted wifi network offline running from a router, just not an ad hoc network or an unsecured network.
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.
I current use libimobiledevice to work around Mac and iPhone. libusbmuxd is very helpful to get device (iPhone/iPad) information when connects to Mac app through USB.
I want more, I want to read/write data (a file like document, image, video, ...) from Mac to iPhone and vice versa but I can't get any document or tutorial on the Internet guiding how to do it.
Can anyone help me
If you want to transmit data between OSX and iOS via usbmuxd it is basically a two step process:
Start a socket server on an arbitrary port on iOS or tvOS
Open a socket connection to the usbmuxd server on OSX at /var/run/usbmuxd.
After you have done that you will receive some control messages from the usbmuxd server on OSX including events for device attach and detach. Each device that has been attached to the usbmuxd server has a unique device id. This device id in combination with the port of the socket server can be used to bind the socket connection to the socket server.
If you want to save yourself the trouble of implementing this procedure from scratch you can have a look at the following frameworks. They both provide a high level API in Objective-C.
https://github.com/rsms/peertalk
https://github.com/jensmeder/DarkLightning
this is actually quite easy.
Have a further look at https://github.com/libimobiledevice
Especially look at the iFuse example.
libusbmuxd is a library to use the usbmuxd, which tunnels any socket connections on the iOS device over USB to a local socket.
On every iOS device you can find an open socket on port 62078. This is the so-called lockdownd, which is used for many things.
With lockdownd you can start the AFC service (Apple File Conduit), which is a network filesystem service.
libimobiledevice does all of this for you. (Look at libimobiledevice/afc.h, here are all filesystem related functions like reading a file, retrieving a directory, etc.)
Things you have to do:
call lockdown_client_new_with_handshake(..)
call lockdownd_start_service(..) with the "com.apple.afc" service
if your device is jailbroken, you get full filesystem access with the "com.apple.afc2" service, but otherwise the standard service should do well.
By the way: The lockdownd connection works only if your device is unlocked.
Ciao, Arno
I have a Symbol PPT8800 that will not connect to Windows Mobile Device Center. It was working, I took it off the cradle, did a hard reset, and now it's not connecting. Is there a setting on the HH itself that is preventing the connection?
I have other Symbol PPT8800's that will connect in the same cradle without an issue.
There are a lot of possible sources for connection problems between a windows mobile handheld device and a PC running WMDC (ActiveSync).
use a known good USB cable
connect USB cable directly into PC and avoid USB hub
verify WMDC connects with another windows mobile device
disconnect handheld and reboot you PC and wait until PC is booted
before trying to connect
"Allow USB connections" has been deselected in WMDC Connection
Settings
sometimes the device setting "Enable advanced network functionality"
in Start/Settings/Connections/"USB to PC" has to be unchecked (or
checked).
the device has a corrupted registry and does not start the connect
(repllog.exe) or does not authenticate correctly. Do a clean boot or
wipe of the device to get the device back to factory defaults
I am sorry, but there are many possible issues that can cause a WMDC connection to fail. Recently I had the prob that after sleep/resume of my PC the USB hubs were in power save mode and I was unable to get device to connect to WMDC.
Does your PC do some 'boing' sound when you attach the USB cable to the device?
What does Hardware Device Manager show? Any exclamation marks?
EDIT: How to wipe a device?
You need to write either a small .net or c++ app using DMProcessConfigXML and the following wap provisioning xml:
<wap-provisioningdoc>
<characteristic type="RemoteWipe">
<parm name="doWipe" value="1"/>
</characteristic>
</wap-provisioningdoc>
[see also http://peterfoot.net/UsingRemoteWipe.aspx]
or use RapiConfig tool from Mobile SDK.
If both are not useable for you (is that running Windows Mobile or Windows CE?) or just restore factory default or reflash the device. If it is a device with Windows Mobile before version 5, you can just do a cold boot but delete any persistent folder first (ie Flash File Store or ???).
Factory restore of PT 8800:
hold white RESET button + POWER + FUNC
I am currently using GCDAsyncUdpSocket to build a app that can communicate with UDP protocol.
I am testing whether the connection work with this iPhone app "UDP_Test" >> App link
When I send msg from my iOS simulator, the message does appear received on my iPhone "UDP_Test" app. However, when I download my project to the other iPhone and setup the connection with the iPhone that has "UDP_Test" app, the communication does not work.
Then I tried using "UDP_Test" for the two iPhone to communicate, it does not work as well. Same goes to iPad and iPhone. Is there a restriction for both iOS device to communicate with UDP?
Thanks.
I have found a way. We have to go to Network setting and choose your network. Then go to "HTTP Proxy" and choose "Manual" then enter the port that your device going to listen to, then it works.
Your two devices needed to be on the same subnet of the WiFi network.