MultipeerConnectivity is broken / cannot connect
| Originator: | kai.engelhardt93 | ||
| Number: | rdar://27749182 | Date Originated: | 8/8/2016 |
| Status: | Open | Resolved: | No |
| Product: | tvOS SDK | Product Version: | 10.0 Beta 4 (14T5308d) |
| Classification: | Serious Bug | Reproducible: | Sometimes |
Summary: MultipeerConnectivity is finally available on tvOS 10 - hooray! Unfortunately it is broken, because peers cannot connect to each other. When a peer sends an invitation to another peer the status of that peer changes to .connecting, stays like that for a couple of seconds and then instead of changing to .connected, it changes to .notConnected. The objective of the app is to have a macOS app to act as a server, which accepts all connection invitations, and a tvOS app which browses for Macs running the macOS app and connects to them. I’ve tested my two apps on a Macbook Pro and the tvOS simulator as well as two different Apple TVs. As described above the devices have big trouble to connect with each other. In about 95% of the cases the connection goes to the .connecting and then to .notConnected state. On random occasions (I have yet to find out under which circumstances) the connection is successful, even though I didn’t change anything in my app or network setup. Of course I ensured that both devices are on the same network and tested both wired and wireless connections. The same tests with an iOS device and Apple TV have showed the same results. I have created a demo project for you. It has three targets. One for iOS, one for tvOS and one for macOS. The demo app shows you the discovered peers. When you tap/click on a discovered peer an invitation is sent to it and the invited peer accepts the invitation. During the connection process two labels show you which peers are in .connecting and .connected state. Steps to Reproduce: 1. Download my demo project. 2. Run the tvOS target and any of the iOS and macOS targets. 3. Ensure that the test devices are on the same network. 4. You should see the discovered devices in the table. 5. Select one of them and observe the connection process in the status labels “Connected peers: ” and “Connecting peers: ” 6. You’ll observe that the invited peer goes to .connecting state and then changes to .notConnected. 7. (optional) If you are lucky the devices connect to each other. As I said this happened to me sometimes as well, but it is only about 5% of the times. Please retry the process. You’ll eventually see the bug. Expected Results: The peers should connect to each other flawlessly (> 99% of the time). Actual Results: The peers only connect in about 5% of the case, although they are on the same network or even on the same machine, in case you run the macOS app and tvOS app in the simulator on the same machine. The console log is full of diagnostics that the session is not in the connected state: 2016-08-08 17:16:12.395869 MultipeerConnectivityBug[11418:2389470] [GCKSession] Not in connected state, so giving up for participant [01E1F311] on channel [5]. This bug is basically a show stopper for my app and I hope this works by the release of tvOS 10. Version: tvOS 10.0 Beta 4 (14T5308d) Notes: It seems that the MultipeerConnectivity framework is working on versions prior to iOS 10 and macOS 10.12. Since the frameworks introduction on the Apple TV it does not work anymore. There is a StackOverflow question from a different developer who has the same problem as me: http://stackoverflow.com/questions/38745370/multipeer-connectivity-not-connecting-programmatically#comment64961777_38745370 Configuration: OS X El Capitan 10.11.6 / iOS 10 Beta 4 / tvOS 10.0 Beta 4 (14T5308d) Attachments: 'MultipeerConnectivityBug.zip' was successfully uploaded.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!