iOS14以后,使用組播廣播功能需要申請權限。
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、登錄開發者賬號,證書管理界面,在AppID的配置界面,增加對應權限: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
權限問題解決完畢,組播廣播功能可以正常開發使用了。