admin管理员组文章数量:1351851
In order to stay under the 30 MB memory limit for widgets I'd like to profile the widget in the Simulator in Instruments. However, Instruments doesn’t start the profiling session with the error message: Unable to install app with path: …
All I did in Xcode: I created a fresh scheme for the widget target and selected "Profile".
Is this supposed to work?
Update: As suggested by @lll in the comments, I tried to profile the host app, then attach Instruments to the Widget process. However, this fails as well, see screenshot. It might be because the Widget process only runs for a very short time.
In order to stay under the 30 MB memory limit for widgets I'd like to profile the widget in the Simulator in Instruments. However, Instruments doesn’t start the profiling session with the error message: Unable to install app with path: …
All I did in Xcode: I created a fresh scheme for the widget target and selected "Profile".
Is this supposed to work?
Update: As suggested by @lll in the comments, I tried to profile the host app, then attach Instruments to the Widget process. However, this fails as well, see screenshot. It might be because the Widget process only runs for a very short time.
Share Improve this question edited Feb 24 at 20:05 Ortwin Gentz asked Feb 24 at 19:26 Ortwin GentzOrtwin Gentz 54.1k24 gold badges139 silver badges219 bronze badges Recognized by Mobile Development Collective 4- You want to profile the host app and then attach to the widget process when it’s running in the Simulator. – l'L'l Commented Feb 24 at 19:36
- @lll thanks, unfortunately this doesn’t work either. See my update. – Ortwin Gentz Commented Feb 24 at 20:06
- @OrtwinGentz can you add a minimum reproducible example? – Abhinav Mathur Commented Mar 2 at 13:21
- @AbhinavMathur just use any widget sample code (developer.apple/documentation/widgetkit/…) and try to profile the widget on the Sim. – Ortwin Gentz Commented Mar 2 at 21:36
1 Answer
Reset to default 1 +50Keep the Widget Alive Longer (Debug Build Trick)
In the widget’s code (under a
#if DEBUG
check), add a small delay so Instruments has time to attach:#if DEBUG _ = DispatchSemaphore(value: 0).wait(timeout: .now() + 30) #endif
Remove this workaround before shipping.
本文标签: xcodeHow to profile iOS widgets in InstrumentsStack Overflow
版权声明:本文标题:xcode - How to profile iOS widgets in Instruments? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743662130a2518127.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论