iOS Multicast Setup & Best Known Methods

After working on getting multicast working in my iOS app, I wanted to document things to help give others a leg up down the road as the Xojo information in this space isn’t super comprehensive.

  1. First Request the com.apple.developer.networking.multicast entitlement from this Apple Developer page.
  2. Apple will review the request and hopefully get back to you with an approval.
    • At least for me this was very much a blackbox process with no confirmation that I placed the request and only an email back from them once approved. At the time of this writing, this process took almost 5 business days (requested over the weekend and approval came in mid-afternoon on Friday)
  3. Once approved, you’ll need to go into the Apple Developer Portal.
  4. Open the App ID you requested multicast for and you’ll find a new Additional Capabilities tab
  5. Click this tab and enable the Multicast Networking item.
  6. Next, go into Profiles and regenerate all profiles using this App ID.
    • Once you do step 5, these profiles will become invalid (I forget the exact phrase Apple tags them as) so this will be a good clue as to which need to be regenerated.
    • To regenerate them, open each profile, press the Edit button, followed by Save and then Download
  7. Open the downloaded profile files to install them on your Mac.
  8. Next, you’ll need an entitlement file and @Greg_O has the best solution of creating this within Xcode.
    • If you haven’t already done, so create the skeleton for your app within Xcode.
    • Add in the Multicast Networking entitlement by selecting your Project » Signing & Capabilities » + Capability » Select Multicast Networking
  9. Within the Finder you’ll find a YourApp.entitlements (certificate looking icon) file within your Xcode app project within the Finder.
    • Personally, I copied this file over to my Xojo app project folder, but you can likely store it wherever you desire.
  10. Within Xojo, assign the entitlements to your iOS app.
    • Build Settings » iOS » Inspector Pane » Gear tab » Entitlements section » … button

You’re now all set and multicast networking should work for you in your iOS app when you go to production.

Here are some additional references to assist…

Also note that if you happen to start using an entitlements file without the proper approval, Xojo will fail to compile your app, but doesn’t speak to this being a problem. I’ve already filed a ticket to try and get the error message to be more descriptive.

For those who have already gone down this road, please chime in with corrections or anything else I might have missed.

4 Likes

Just a quick note, if what you’re trying to do is communicate between iOS devices or macOS devices (or both) you could just use Apple’s Multipeer Connectivity framework.

If you want a fully developed product, I sell a framework for macOS and iOS on the Xojo extras store.

https://www.stretchedout.com/yaxew/products/multipeer.html

1 Like

Yes absolutely! And although I can’t personally vouch for the Multipeer product, Greg O is top notch and I’m sure he’s made a fabulous product.

Patrick,

Great thread. Thank you for posting this.

Something I do want to point out to our audience that I have learned about multicasting in iOS. If utilize multicast groups please know that this feature is somewhat wonky in iOS. I have found that yes the connections work but then once your iOS device goes to sleep, iOS breaks down the group connection. If I remember correctly, it seems Xojo doesn’t recognize this and doesn’t reconnect to the group upon wake up. It’s been a while since I’ve looked at this in depth, but due to some other reasons I am in the process of moving all my multicast to straight broadcasts instead of utilizing a group. I would recommend anyone else doing multicasting in iOS to not utilize groups and just do straight broadcasts both on the desktop and iOS side.

1 Like

Some great background to add Jon and thanks. I personally haven’t tried multicast groups, but I can confirm that general broadcasts under Xojo appear to be pretty solid and reliable.

Would this work on windows as well ? or linux ? i have my users all having iPhones, but due to the nature of the work they all use Windows computers .

Thanks

No. It’s an Apple framework.