由 xpc_connection_send_message_with_reply_sync 超时引发的崩溃

由 xpc_connection_send_message_with_reply_sync 超时引发的崩溃

💡 原文中文,约3300字,阅读约需8分钟。
📝

内容提要

2023年9月1日,发现iOS系统接口调用xpc_connection_send_message_with_reply_sync方法可能导致超时卡死。问题出现在iPhone 6s和iPhone 7等低端设备上,大部分是iOS 15.7系统。建议检查调用xpc_connection_send_message_with_reply_sync的频次,并避免调用能触发该接口的方法。修复后发布新版本解决了Crash。

🎯

关键要点

  • 2023年9月1日,发现iOS系统接口调用xpc_connection_send_message_with_reply_sync方法可能导致超时卡死。
  • 问题主要出现在iPhone 6s和iPhone 7等低端设备上,大部分是iOS 15.7系统。
  • 建议检查调用xpc_connection_send_message_with_reply_sync的频次,并避免调用能触发该接口的方法。
  • Crash的错误描述显示应用因超时被watchdog关闭,集中发生在低性能设备上。
  • xpc_connection_send_message_with_reply_sync是用于进程间通信的同步方法,可能导致UI无响应。
  • 问题可能是由于多线程环境中频繁调用xpc_connection_send_message_with_reply_sync导致的。
  • 修复建议包括后移调用xpc_connection_send_message_with_reply_sync的时机,避免在主线程调用。
  • 通过在CLLocationManager的delegate中监听定位权限变化来避免问题,修改后发布的新版本解决了Crash。
➡️

继续阅读