App Clips & Multipeer Connectivity

Hi! I have an app with Multipeer Connectivity setup and working properly.

I now would like to add an app clip that is also able to connect to the main app target via Multipeer Connectivity.

I've added the NSLocalNetworkUsageDescription as well as the NSBonjourServices to the app clip's info.plist, just like I did for the main app target, however when I run the app clip target, I get the following output at the Xcode console:

[MCNearbyServiceBrowser] NSNetServiceBrowser did not search with error dict [{
    NSNetServicesErrorCode = "-72008";
    NSNetServicesErrorDomain = 10;
}].

I'm now wondering if it is possible to have app clips leverage Multipeer Connectivity and, if so, what else I should do to resolve the issue.

Thanks in advance!

Answered by DTS Engineer in 706447022

I've continued my research and I may have found an element of response to my own question on the following piece of documentation about app clips

Yep. To close the loop here:

  • Multipeer Connectivity relies on Bonjour.

  • The doc you referenced explicitly states that Bonjour is not supported in an App Clip.

  • So Multipeer Connectivity is not supported in an App Clip.

This isn’t an accident but a deliberate design choice. If you’d like to see that change, I encourage you to file a bug with information about your requirements, that is, why using Bonjour makes sense in your App Clip.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I've continued my research and I may have found an element of response to my own question on the following piece of documentation about app clips: https://developer.apple.com/documentation/app_clips/choosing_the_right_functionality_for_your_app_clip -

App Clips provide an in-the-moment experience and focus on offering the quickest possible solution to an everyday task, so some functionality works best in your full app. Reserve the following functionality for the full app:

Advanced networking features like Bonjour and low-level networking APIs like CFSocket, or POSIX functions; instead, use URLSession or the Network framework.

Accepted Answer

I've continued my research and I may have found an element of response to my own question on the following piece of documentation about app clips

Yep. To close the loop here:

  • Multipeer Connectivity relies on Bonjour.

  • The doc you referenced explicitly states that Bonjour is not supported in an App Clip.

  • So Multipeer Connectivity is not supported in an App Clip.

This isn’t an accident but a deliberate design choice. If you’d like to see that change, I encourage you to file a bug with information about your requirements, that is, why using Bonjour makes sense in your App Clip.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you Quinn for your high quality response, as usual! 🙌

I've now replaced my Multipeer Connectivity-based multi-device communication layer with a solution that leverages CoreBluetooth, which is supported in App Clips, and all is well so far.

For those who stumble onto this thread at a later time, just a note that there are still certain limitations to the use of bluetooth in App Clips (https://developer.apple.com/documentation/app_clips/choosing_the_right_functionality_for_your_app_clip):

... For example, App Clips can’t make use of the following functionality:

  • ...
  • The ability to maintain Bluetooth connections while the App Clip is not in use

But this is acceptable for my use case.

Also, if you need help getting started using CoreBluetooth, I can recommend the following library: https://github.com/rhummelmose/BluetoothKit

App Clips & Multipeer Connectivity
 
 
Q