iOS 14 以后,使用组播广播功能 需要 申请权限 。
1、申请地址:https://developer.apple.com/contact/request/networking-multicast ;
2、填写相应的 App Information ,提交了等待审核 ;
3、等待几天,审核通过了会给你发邮件:
Your request to use Multicast Networking was approved. You can now add the Multicast Networking entitlement with your Provisioning Profile.
4、登录开发者账号,证书管理界面,在 App ID 的配置界面,增加对应权限:
Additional Capabilities 中,把 Multicast Networking 给勾上;
5、重新生成 Profiles 里对应的证书;
6、在工程里配置 .entitlements 文件,增加一项
Key:com.apple.developer.networking.multicast
type:boolean
Value:YES
7、在 Info.plist 文件中,添加本地网络使用权限:
Privacy - Local Network Usage Description
权限问题解决完毕,组播广播功能可以正常开发使用了