Xcode wireless debugging over iPhone's hotspot in the park [solved] - iphone

For me wireless debugging works flawlessly on my home Wi-Fi, but I always wanted to go in the park and have the freedom of developing applications without the cable, where my iPhone provides Internet via its hotspot.
It would be nice if Apple reconsiders the hotspot and allows wireless debugging and all the other useful features to work without the need of entering IP manually or looking for workarounds.
See my answer in the replay below:

Connect to iPhone's hotspot. Disconnect the USB cable. My iPhone is still visible under Devices because wireless debugging is enabled, but I cannot run and debug applications. Control + click the iPhone, and select: Connect via IP: 172.20.10.1 Done! Now it just works.
Thanks to eskimo's advice

Related

Create an iPad app that can send/receive data via the USB cable?

I want to create an iPad app that connects to another machine, laptop or otherwise, via USB and communicates to some other application I develop running there.
I know that this is easy to achieve via Bluetooth or WiFi but this particular set of solutions must be done via a USB cable.
Is it possible to do so without access to the Apple MFi program? (I am about 5 weeks in and the response is not looking good).
iOS App --> USB Cable --> Mac OSX --> Desktop App (without MFi access)
Thanks
To use USB communication Apple does not provide any API within IOS SDK. The only option right now is MFI. I don't think Apple will allow this in near future.
To use serial communication, you need MFI as you may have discovered. However, there is a poor man's way of achieving this. I have done so during development.
Enable "Internet sharing" on your device and connect to it. Use "ifconfig" on your Mac to find out the interface to use. You do not need to use this as the default connection, but it needs to be active. If I remember correctly, only one end can initiate connections (it was a while so I am sorry that I don't remember the details).
EDIT: I would also like to point out that I did this on an iPhone, not an iPad.
Not over USB but over RS232 (serial port)
Look here: http://www.redpark.com/c2db9.html
But:
The cable uses the old 30 pin connector, but according to them it's compatible with the Lightning adapter
The application won't be accepted on the AppStore, it's for internal use only.
There is a (small) book that explains how to use this cable to connect an iPhone directly to an Arduino, it's been published in late 2011. "iOS Sensor Apps with Arduino Wiring the iPhone and iPad into the Internet of Things" http://shop.oreilly.com/product/0636920021179.do

Why iphone Bluetooth chat application working without activating bluetooth or wifi?

I have created iphone bluetooth chat application using following tutorial:http://www.devx.com/wireless/Article/43502/1954.
It works well.But when i turn off wifi and bluetooth both in my pc and test with
iphone simulator with another pc which has also turned off its bluetooth and wifi.
It still works fine and both peer discovers each other.both pcs are conneted through LAN.
Can anyone tell why this happens?
I guess the simulator just performs discovery using any available network connection. I very much doubt that the simulator was using the Bluetooth of your PC for peer discovery.
As you say, "Both PCs are connected through LAN". Well, I guess that is your answer. Discovery is being done via LAN.
If you want to test actual bluetooth usage scenarios, I guess you have to use an actual device.

Reachability App 2.2 - Local Wifi does not restore

Can somebody explain why the reachability app behaves strangely?
I built it under IOS 4.2
When I start it, all three text boxes show an available network.
If I turn the airport off, they all show no connection.
Turning the Airport back on again only Remote Host and TCP/IP routing are shown as availabl. Local Wifi remains 'Access not available'
This may seem like a dumb question, but did you build it in the simulator? Results on the simulator won't mirror those on the device, as the 3G in the simulator is simply an abstraction of the wifi radio in your Mac. You'll need to use a device in order to see it work.

Debugging an iOS app with an external accessory connected via Dock

Am I missing something glaringly obvious or is there no way to debug an iOS app which uses an external accessory that's connected via the 30-pin dock without using a bucket load of logs etc. I want to be able to use things such as breakpoints and Instruments.
Is there a way to remote debug perhaps, over Wi-Fi, Bluetooth?
Note: Yes, I asked this very recently and I deleted it because I thought I found the answer.. but the answer was only Instruments has support over Wi-Fi.. not Xcode debugging. So the question still remains...
And so...: Given that I've had no real luck finding the answer, and no one has given me an answer as yet - I take it that it is a big fat NO. :(
Makes me wonder are we just expected to magically guess where bugs occur, or log the crap out of everything while wearing out our dock connectors by continuously moving it back and forth between the device and accessory?
Time to file a bug report I guess.
At CES today, I talked to a developer from Wahoo Fitness that makes an ANT+ accessory for iPhone. They had this same problem, but found a solution.
They found a pass-through dock extender that has a mini-USB port. They used the mini-USB port for debugging while the accessory was connected.
The product they were using is http://www.cablejive.com/products/dockStubz.html
This blog talks about remote debugging iOS with a dock accessory attached
You could connect the external accessory to another iOS device (not the one tethered to the Mac running the Xcode debugger). Then tunnel all your EA framework messages from the accessory connected device to the device running the app being debugged over a pair of wifi sockets. Look at the code for tunneling accelerometer messages from a device to the iOS Simulator (a common trick for debugging game code on the Simulator) for one example of how this could be done.
After further researching, and having seen that people had to do sending strings over Wi-Fi to get around this, I'm concluding the answer is no.
I have filed a bug request for this.
In the mean time, it seems like the Wi-Fi logging, and on-device text logging will be the way to go for now.
Here's my understanding for why just the USB protocol works for some external accessories and doesn't for other external accessories. Looks like a fundamental problem, without an arbitrator, two masters can't talk to a single slave over USB, a serial Master/Slave protocol. So XCode is one master, the iPhone is the slave device. If the external accessory is a master too, one won't be able to connect the iPhone (Xcode slave) to the second master (the external accessory).
Probably the Wahoo Key for iPhone" is a slave device and that's why the dockStubz solution works for such an external accessory.
I have tested the dockStubz. It doesn't work for my external accessory. As suspected, the USB protocol can't be used to have two Master devices controlling a single slave device. Trying to hook up a Mac (Master) (via the mini USB ) & an external accessory (Master) (via the 30 pin connector) to the iPhone 4 (Slave) causes the iPhone to go in loop of connect & re-connect.
Following looks promising too, though expensive: digi.com/support/kbase/kbaseresultdetl.jsp?id=485.
Has any one tried to use USB to Ethernet connectors and use a router to route requests from two masters (XCode & External Accessory) to the slave (iPhone)? I am off to Best Buy to purchase USB to Ethernet cables and hook all three on to my IP router. Will report if it works.
This is what will be needed :
http://www.bestbuy.com/site/IOGEAR+-+USB+Ethernet+Extender/9614781.p?id=1218131339965&skuId=9614781&st=USB%20to%20Ethernet&cp=1&lp=1
http://www.frys.com/product/6103339
So connect XCode mac using the male end into the USB slot of your computer. . Use a ethernet cable to connect this to a router.
Connect the iPhone to the female part of the IO gear connector. Connect it to the router via ethernet cable.
Connect the external accessory with the male connector (Sabrent USB to Fast Ethernet Network Adapter.) Connect it to router.
I am still researching if this will work. Just ordered the parts. Will get it by Friday & will report back then.
Update:
The IOGear male end draws too much current when connected to router. Also, the female end can't charge iPhone when connected to the router even when 5V USB current supplied.
So tried to directly connect the iPhone to the USB slot of the router (used for printers). It does charge the iPhone. Also used USB to Fast Ethernet Network Adapter (BestBuy had one to connect Wii via USB) to connect the Mac to the router. It did connect to internet but couldn't find the iPhone. In the router client list I don't see any login entires for the iPhone. So this experiment was a failure unless someone have other pointers.

IPhone Connectivity Testing: How do I force it to lose connection?

Apple wants me to give the user a friendly apology if I can't find an internet connection. Using the Reachability Demo, this was easy enough. I want to take it a step further and monitor for a connection loss. The demo has this functionality, but I can't figure out how to shut my connection off to test if it works.
How would I go about simulating a loss of (or actually losing) a connection?
If you're developing in the iPhone Simulator, simply disconnect your computer from the internet. If your computer has no network access, neither does the iPhone Simulator.
To test on the device, you can do the following:
First, setup a WiFi router that you can use for testing.
You can turn on Airplane mode on the phone, then turn WiFi back on. This will prevent the 3G connection from providing data access.
Launch your application. Now you can simply disconnect your WiFi router to simulate a loss of connectivity.
You can use the SpeedLimit preference pane to simulate network latency under the simulator. And here's a command line version built on top of the ipfw command.
The advantage over just yanking the cord or killing WiFi is that you can specify the speed when hitting specific hosts so it can be used for testing without killing your regular network services.
You could install Apple's Network Link Conditioner
On Yosemite:
Network Link Conditioner can be found in the "Hardware IO Tools for Xcode" package. This can be downloaded from the Apple Developer Downloads page. Once the download has finished, open the DMG and double-click "Network Link Condition.prefPane" to install (source).
With this preferences panel you could create a profile with 0kbps speed.
On older versions of OSX:
Mountain Lion / Mavericks: Xcode > Open Developer Tool > More Developer Tools
Lion: /Developer/Applications/Utilities/Network Link Conditioner
For testing in the simulator I make great use of Little Snitch. It's a very useful application for writing rules as to what can communicate with the outside world and for how long.
It will also notify you if an application wishes to access the internet on the fly and you can temporarily restrict access for either that time, that session or forever.
As for testing on the device, I log into my wireless router and temporarily disable either the network or turn on restriction by MAC ID for the duration of the test.
Use Charles Web Proxy
You can inspect all HTTP/S requests your app sends and responses it receives, throttle connection to simulate any network speed. Create custom throttle profile called "Disconnected" with Bandwidth = 0, to simulate network disconnections.
Perhaps this preference pane is also useful for you: SpeedLimit.prefPane it can't loose the connection, but you can slow down it based on the host and port you're trying to reach.
Searching for similar need i.e. simulating a lossy wifi network connection on real device, I figured out how to do it :)
I connected my MacBook Pro on ethernet and shared my Wifi connection to the device.
Using Apple's Network Link Conditioner Prefpane then let me played with the connection quality.
Very useful to simulate 3G, Edge and other baudrate.
Next step : find and buy a usb wifi adapter working on MAC OS X to let all of us (developpers team) to test without wiring each computer to ethernet.
Hope this will help some of you.