0

I've found a function here to get all the running processes How to get information about free memory and running processes in an App Store approved app? (Yes, there is one!)

but obviously there's a lot of system process.

Is There a way to get the running processes that the user launched?

Community
  • 1
  • 1
Gnamm
  • 633
  • 2
  • 8
  • 17

1 Answers1

0

Haven't tried it, but if you read the manual (https://developer.apple.com/library/ios/documentation/system/conceptual/manpages_iphoneos/man3/sysctl.3.html) it looks like you could replace KERN_PROC_ALL with KERN_PROC_UID...

RishiG
  • 2,460
  • 1
  • 11
  • 27
  • You mean something like this? int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_UID, 0}; so it show some system processes but not the app launched by the user – Gnamm Nov 20 '13 at 20:20
  • Yep, except you need to place the user ID in the last slot instead of 0. – RishiG Nov 20 '13 at 20:29
  • Ok, now I have int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_UID, getuid()}; but it returns 125 processes but I have only 4 opened apps. – Gnamm Nov 20 '13 at 20:38
  • Hmm, I see. I guess this is not the right answer. Maybe someone else has a better idea. – RishiG Nov 20 '13 at 20:51