English 中文(简体)
• 如何说明其他多少次仪器在背景中运行?
原标题:How to figure out how many other apps are running in the background?

My friends are making a high-performance game which will lag if many other apps are running.

是否有办法说明现在背景中有多少人正在运行? 有一个称为“活动监测”的用户,显示所有的背景过程,并且已经批准申请。 甚至还显示了背景图象。 我猜测,它会接触小型电灯以示光。

它显示有线、主动、不活跃和免费的记忆以及免费磁盘空间的使用情况。

我总是认为,在我看到这一 app!

因此,这一想法是: 检查有多少免费记忆,以及有多少背景传闻。 然后告诉用户,由于这种情况,业绩可能滞后,并建议终止其中一些。

问题回答

Determine how many apps run in background: (use xcode)

mach_port_t *p = (mach_port_t *)SBSSpringBoardServerPort();
char frontmostAppS[256];
memset(frontmostAppS,sizeof(frontmostAppS),0);
SBFrontmostApplicationDisplayIdentifier(p,frontmostAppS);
NSString * frontmostApp=[NSString stringWithFormat:@"%s",frontmostAppS];
NSLog(@"Frontmost app is %@",frontmostApp);
//get list of running apps from SpringBoard
NSArray *allApplications = SBSCopyApplicationDisplayIdentifiers(p,NO, NO);
for(NSString *identifier in allApplications)
{
    NSString *locName = SBSCopyLocalizedApplicationNameForDisplayIdentifier(identifier);
    NSLog(@"identifier:%@, locName:%@",identifier,locName);
}




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签