首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在SpringBoard上调用iOS方法

在SpringBoard上调用iOS方法
EN

Stack Overflow用户
提问于 2012-01-06 16:06:02
回答 1查看 2.7K关注 0票数 1

我正在做一个调整,我有个问题。我创建了一个PreferenceBundle,在包中我需要调用一个SpringBoard方法,但是结果总是null。有什么方法可以调用SBApplication方法吗?

代码语言:javascript
复制
SBApplication *app =[[objc_getClass("SBApplicationController") sharedInstance] applicationWithDisplayIdentifier:identifier];
EN

回答 1

Stack Overflow用户

发布于 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

编辑:

你能试试这段代码吗:

代码语言:javascript
复制
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

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8760720

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档