Programmatically detect which iOS application is visible to user

…衆ロ難τιáo~ 提交于 2019-12-07 16:08:59

问题


I found this and the problem is that the answers on that question didn't pan out (I also tested them first) and also that it is over a year old.

I've used the solution here to fetch the list of all running processes, but not of the struct kinfo_proc attributes seem to give any useful in detecting which app is currently visible to the user.

Basically:

I am trying to find out which app is currently visible (and open) to the user on iOS devices. It must work on stock devices (non-jailbroken) and no need to worry about the app store.

Edit: I am looking at the private APIs now, but cannot seem to determine how my app could be notified (or inquire) about a new application being brought to the front.

Thank you


回答1:


Thanks to @JohnWoods in the comment section of the question, I was able to find the solution on a related question.

The solution I used and that worked for me was here.



来源:https://stackoverflow.com/questions/20200385/programmatically-detect-which-ios-application-is-visible-to-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!