Multipeer Connectivity : Not discovering device over Wifi Infrastructure - ios

I created a network on my Macbook Pro (Right below the list of WiFi's) and I had 2 iOS 7 (iPad 2 & iPod Touch) devices join to this network. When I started to browse for devices, I just have the "Searching " and the wheel spinning in the native BrowseViewController. Apparently one device is not discovering the other device. But the setup works when I have bluetooth switched ON on both. Please, can you help me with this ?

I'm actively developing MPC at the moment and debugging using two Macs. As #samkit mentions, the devices need to be on the same WiFi network. If that is true for you, make sure you also implement the didReceiveCertificate method per this answer to ensure your devices get to the connected state

Make sure that Both devices are connected to same wifi. They will definitely work.

I think I have found out the issue. In fact, an observation here. It is not working only on the iPad 2 I am using. I tried the same code with 2 iPods, the result : ButterSmooth.
But what hurts is the fact that nowhere its mentioned. Note, my iPad 2 is running iOS 7.

Related

Add iOS device to Xcode's devices for debugging/building without cable

I was wondering if anyone knew of a way to add an iOS device and enable the 'Connect via network' option for an that device in Xcode without first connecting the device to the computer with a lightning cable.
My situation is that both of my USB ports are broken so I can't connect any device to my computer via a lightning cable.
By the way, wifi syncing is already enabled on my computer for one of my iOS devices, the one I'd also like to use for wireless debugging on Xcode. I don't know if that helps at all..
Unfortunately not, see the picture it must be found first in devices:
What type of computer is it? Potentially if you have a thunderbolt port, you could buy or even borrow a thunderbolt to USB adapter. I have one such for an iMac 2011 to convert thunderbolt 2 to usb 3. Any Mac from mid 2011 onwards including MacBook Air, pro or iMac should have it. I know it might sound expensive, but these days the adapters can be had cheaper.
Here is a link to the one I have on Apple Store and can confirm it works, and it might be useful anyway.
Kanex Thunderbolt to eSATA + USB 3.0 Adapter
And if after using it, you don't like it, Apple usually have a 14 day return policy.

Xcode 9 Wireless debugging not working

For some reason the wireless debugging does not work here. Here is what I've done:
Using newest Xcode 9
Using newest iOS 11 on my iPhone 7+
Both devices are in the same network
Connected the iPhone via Lightning, selected "Connect via Network" in the Devices & Simulator menu
Run an app on the iPhone while still connected via Lightning - everything works
But as soon as I unplug the phone, Xcode is no longer able to connect with the phone. I can ping the phone with the Mac, but even the "connect via ip" option in Xcode does not work.
Anybody got tips on how to get this working?
I had the same issue, but it was intermittent - i.e. sometimes the globe would not appear next to the phone name in Xcode Devices and Simulators window and when the phone was disconnected from the lighting cable, I could not debug to it from Xcode. My fix was much simpler, though - I just turned WiFi on and off both on the Mac and on the phone. After the devices reconnected to the network wireless debugging was available again. This seems to be an issue with the network communication (regardless whether the device can be pinged or not).
Make sure System Preferences->Internet Sharing is enabled using USB ports:
I was able to find a solution to this on another stack overflow question:
How do you perform wireless debugging in Xcode 9 with iOS 11, Apple TV 4K, etc?.
You can also check this answer: "Connect via network" wireless debugging not working Xcode 9
Near the bottom, from "IOS DEV". Briefly, the solution ended up to be to unpair my phone, disconnect and re-pair. After that Xcode automatically added it with the globe. As an FYI, I was able to ping my iPhone using the network utility prior to the un-paring but was still unable to get the phone to connect. good luck.
Restarting xcode is the only thing that fixed this intermittent connectivity problem for me.
I realized this can also happen if my Mac is connected to a VPN. I had to:
Kill the VPN connection
Turn the computer's wifi off and back on
Open Devices and Simulators
Plug the device in and the globe icon should appear.
Unplug the device and make sure the globe icon is still there.
Run the app via network!
Wireless debugging mysteriously stopped working for me until I turned off my VPN client. I now believe that I had the VPN turned off when I was trying it out the first time, but then the VPN auto-connected after my computer restarted sometime later.

multipeer connectivity test on iphone and a simulator simultaneously

Hello I was searching in all topics of the forum about how can i test an app which uses multipeer connectivity framework. Can someone tell me how can i test an app by using an iPhone device and a simulator simultaneously, player one for device and player two on the simulator and vice versa. I already test the app by using two simulators one per mac - user on a mac and its working but it is not convenient to continuously switch users to test an app.
I tried all the alternatives, running once in simulator and one on device at the same time,make second target, nothing happened.
Thanks in advance
If you put your iPhone and your Mac on the same WiFi network they should able to discover each other without any problem.
Yes you can test your app on Device an Simulator simultaneously.
I'm developing an app with Multipeer Connectivity right now and communication between
Iphone and Simulator works fine.
I'm running it on a MacBook Air.
All you have to do is to make sure, that Bluetooth is enabled on your Mac.
You can do this in System Preferences -> Bluetooth.
In addition to testing on WiFi, you can also test your app based on "Multipeer Connectivity framework" on simulator and any IOS device using Bluetooth, As long as simulator and devices are connected in same Personal area network.
For example, on Iphone you can turn on Personal Hotspot (in your phone General settings) to connect your phone with your mac in same personal area network via bluetooth or WiFi and then try testing your app sharing messages between simulator and Iphone using any personal network based on Bluetooth or WiFi.
All the combination will work as long as app using "Mutlipeer connectivity framework" are on same personal area network.

Bonjour not advertising over BT

I've been banging my head against this for the last week or so. I've already gone through the following resources:
StackOverflow: Bonjour over bluetooth WITHOUT Gamekit ? (3844189)
StackOverflow: How does Bonjour Over Bluetooth Work (3350094)
StackOverflow: Using iOS GameKit's “Bluetooth Bonjour” with other platforms (8070998)
Technical Q&A QA1753 -- Apple Developer
WiTap sample application
SRVResolver sample application
DNSSDObjects sample application
I'm using Mac OS 10.7, Xcode 4.5, an iPhone 4 with iOS 6, and an iPad 1 with iOS 5.1.1.
My problem is this: I am modifying an application that currently uses GameKit's peer picker to connect between an iPad and a iP{hone|od touch}. We want to modify this to use Bonjour over Bluetooth instead because we've had issues with reconnecting the devices using Gamekit if the connection is lost. I've used dns_sd.h API to some success and have gotten the service to advertise and resolve over wifi, but even though I am passing kDNSServiceFlagsIncludeP2P I am not getting any success over bluetooth.
I thought possibly Bluetooth Bonjour need a PAN established between devices already, but even pairing the iPad to the iMac and browsing for DNS-SD services gives me nothing...and the iPhone won't pair to the iPad anyway.
I just finished solving this in my own app in the last 24 hours. I used the core classes from the OS X sample app DNSSDObjects. I only had to change three lines of code to add support for bluetooth. This works great in my iOS app.
In DNSSDBrowser.m, the call to DNSServiceBrowse needs to have kDNSServiceFlagsIncludeP2P passed in for the 2nd parameter.
In DNSSDRegister.m, the call to DNSServiceRegister needs the same change.
In DNSSDService.m, the call to DNSServiceResolve also needs the same change.
If you want to limit yourself to just bluetooth, and not WiFi, then the same three lines of code should be updated so the 3rd parameter is kDNSServiceInterfaceIndexP2P instead of kDNSServiceInterfaceIndexAny.
Indeed, it looks like the kDNSServiceInterfaceIndexP2P flag won't work on OSX.
If you run the code on IOS, you'll notice that Bonjour will publish two IP Adresses: one for your local WiFi network, and an 169.xx.xx.xx adress for Bluetooth.
The same code on OSX never publishes the 169.xx.xx.xx adress, so it's only found over WiFi.

Why isn't Bluetooth LE working from the iOS Simulator to my device?

I'm trying to figure out why my BTLE TI CC2540 keyfob is working with my iPad 3 but not with the iOS Simulator equipped with a new GBU521 IOGEAR adapter on Mountain Lion.
I've been able to successfully connect the iOS 5 Simulator Bluetooth in the general settings (it says on, now) to my BT adapter, and to be considered as 'powered on' in my proof of concept app. I'm using a GBU521 IOGEAR adapter, which only worked after upgrading to Mountain Lion (tried Lion with some hack modifying some .kext files-- don't do that. Upgrading to Mountain Lion was impossible until I reverted that .kext). I then ran the Apple suggested nvram setting, rebooted, and it was able to recognize the BT adapter.
I'm able to communicate with my iPad 3 successfully (registering the button pushes, accelerometer, etc), but when I try to run it on the simulator, it just doesn't discover the device. It's telling me the BT state is CBCentralManagerStatePoweredOn, but then when I tell it to discover peripherals, it comes up with nothing.
How can I establish Bluetooth LE communication between the iOS Simulator and an LE-enabled iOS device?
(modified from my answer in other iOS Simulator Bluetooth thread here: Bluetooth Dongle and iOS Simulator)
Throw away the IOGEAR and pick up a Cirago BTA8000.
I'm not sure why you were able to turn Bluetooth on in the iOS Simulator (possibly related to your kext editing, which I tried too), but I suspect it's not actually on. I bought the IOGEAR you mention, in addition to the Cirago BTA8000, and the MediaLink 4.0 adapter. Turns out that anything based on the Broadcom chip won't work despite my MacBook having the exact same one built in, which means the MediaLink and IOGEAR don't work. My Cirago shipment just arrived this morning, and the Bluetooth slider in the iOS Simulator flicks to "ON" in less than a second.
If you want to experiment, I'd love to hear if other non-Broadcom chips work too.
Does your keyfob didn't came with a dongle? I'm planning to buy one :S
Update: I've just found this(But probably you have arleady seen this, it explains why you are using a separate adapter): http://developer.apple.com/library/ios/#technotes/tn2295/_index.html
Also the reviews on amazon of your adapter doesn't look very good. have you tried it with antoher device? http://www.amazon.com/IOGEAR-Bluetooth-Micro-Adapter-GBU521/dp/B007GFX0PY/ref=sr_1_1?ie=UTF8&qid=1344560021&sr=8-1&keywords=GBU521+IOGEAR

Resources