Unity 社区

unity转Mac应用 udp 提示 “Access denied”

,1 年前
发布于技术支持
0
我们在unity路边使用了 .net的 udp (UdpClient)
editor 下 正常使用。 我们使用unity的 build Settings 打包了 PC + Mac + android + iPhone 多个平台包。 但是mac下 调用udp 提示“Access denied”
我们进一步排查 在打包mac时 不勾选 “Create Xcode Project” 直接出安装包 是可以正常使用udp ,勾选后 使用xcode editor模式和使用Xcode打包ipa 包 这种方式就不能使用.
排查的挺头疼的,不知道大有有啥思路 或者 有遇到过吗?
228 次浏览
评论 0
2个回答
0
问题找到了,上架时 苹果强制要求设置 沙盒权限 然后我们设置沙盒权限的时候 未开启“Incoming Connections(server)" 不知道为啥要设置server的权限
1 年前回答
评论 0
0
本回答由团结MuseChat(Beta)生成,请酌情参考。
根据您的描述和搜索结果,以下是解决Unity转Mac应用时UDP提示“Access denied”问题的步骤:
  1. 检查文件权限: 确保所有相关文件和目录具有正确的读写权限。可以在终端中使用以下命令更改权限:
sudo chmod -R ug+rw /path/to/your/project
  1. 配置网络权限: 在Xcode项目的Info.plist文件中添加以下键值对,以确保应用程序具有网络权限:
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
  1. 检查代码签名和沙盒设置: 在Xcode中,确保正确配置了代码签名和沙盒设置。可以在Xcode的项目设置中检查这些配置。
  2. 尝试使用Socket类: 如果问题仍然存在,可以尝试使用System.Net.Sockets.Socket类直接进行UDP通信,而不是使用UdpClient
希望这些步骤能帮助您解决问题。如果问题仍然存在,请提供更多详细信息以便进一步诊断。
[1] UDP 故障排除 - Unity 手册 https://docs.unity3d.com/cn/2021.2/Manual/udp-troubleshooting.html
[2] 使用 Xcode 帧调试器 - Unity 手册 https://docs.unity.cn/cn/2021.1/Manual/XcodeFrameDebuggerIntegration.html
[3] Unity解决Udp客户端无法接收数据的问题 - 技术专栏 - Unity官方开发者社区 https://developer.unity.cn/projects/65a6591fedbc2a001d9e615e
[4] Unity IOS Build error – Access to the path is denied - Unity Engine - Unity Discussions https://discussions.unity.com/t/unity-ios-build-error-access-to-the-path-is-denied/767058
[5] Unity - Manual: Troubleshooting on iOS devices https://docs.unity.cn/Manual/TroubleShootingIPhone.html
[6] Unity - 手册:使用 Xcode 和命令行工具进行签名 - Unity 文档 https://docs.unity3d.org.cn/Manual/macosnotarizationxcode.html
[7] Xcode Error when building - Thread 1: EXC_BAD_ACCESS - Unity Engine - Unity Discussions https://discussions.unity.com/t/xcode-error-when-building-thread-1-exc_bad_access/770982
[8] Unity - Manual: Troubleshooting on iOS devices https://docs.unity3d.com/Manual/TroubleShootingIPhone.html
[9] 将应用程序提交到 Mac App Store - Unity 手册 https://docs.unity.cn/cn/2020.3/Manual/HOWTO-PortToAppleMacStore.html
[10] Mac用Xcode建立TCP和UDP Socket(套接字)编程_mac udp服务器代码-CSDN博客 https://blog.csdn.net/qq_51802524/article/details/124769460
[11] UdpClients, working on pc, but android causes SocketException Access Denied - Permissions Problem - Unity Engine - Unity Discussions https://discussions.unity.com/t/udpclients-working-on-pc-but-android-causes-socketexception-access-denied-permissions-problem/558157
[12] UnauthorizedAccessException: Access to the path ... is denied. - Unity Engine - Unity Discussions https://discussions.unity.com/t/unauthorizedaccessexception-access-to-the-path-is-denied/714237
1 年前回答
评论 0
本答案由团结MuseChat(Beta)自动生成,申请使用,反馈渠道

AI

全新AI功能上线

1. 基于Unity微调:专为Unity优化,提供精准高效的支持。

2. 深度集成:内置于团结引擎,随时查阅与学习。

3. 多功能支持:全面解决技术问题与学习需求。

AI