我正在做一个调整,我有个问题。我创建了一个PreferenceBundle,在包中我需要调用一个SpringBoard方法,但是结果总是null。有什么方法可以调用SBApplication方法吗?
SBApplication *app =[[objc_getClass("SBApplicationController") sharedInstance] applicationWithDisplayIdentifier:identifier];发布于 2012-01-06 16:16:15
这个链接将让您了解如何在PreferenceBundle中使用iPhone.
http://www.skylarcantu.com/blog/2009/08/12/creating-a-preferencebundle-for-the-iphone/
http://iphoneincubator.com/blog/tutorial/how-to-create-an-iphone-preferences-file
编辑:
你能试试这段代码吗:
Class SBApplicationController = objc_getClass("SBApplicationController");
id controller = [SBApplicationController sharedInstance];
for (NSString *appId in [controller allBundleIdentifiers]) {
NSLog ([NSString stringWithFormat:@"bundle: %@", appId]);
NSArray *apps = [controller applicationsWithBundleIdentifier:appId];
if ([apps count] > 0) {
id app = [apps objectAtIndex:0];
[self indexApp:app withName:[app displayName]];
}
}或者试试下面的链接。
http://pastebin.com/dQK5AXjD
https://stackoverflow.com/questions/8760720
复制相似问题