iOS 偏好包

发布于 2024-12-25 06:13:09 字数 418 浏览 4 评论 0原文

我正在开发一个 iPhone 调整,使用 Preferences 创建了一个 PreferenceBundle ,在包中我需要调用 SpringBoard 方法,但结果总是什么都没有。有没有办法可以调用 SBApplication 方法?

我使用 objc_getClass 来获取类,

SBApplication *app =[[objc_getClass("SBApplicationController") sharedInstance] applicationWithDisplayIdentifier:identifier];

当我使用它来调用方法时,结果为 null。

有可能吗,或者我可以做一些黑客工作。我需要从 SBApplication 获取图标路径。

i'm developing a iPhone tweak, with the Preferences i created a PreferenceBundle and in the bundle i need to call a SpringBoard method, but the results is always nothing. Is there a way i can call a SBApplication method?

i am using objc_getClass to get the class

SBApplication *app =[[objc_getClass("SBApplicationController") sharedInstance] applicationWithDisplayIdentifier:identifier];

when i use that to call the method the result is null.

Is it possible, or some hack i can do. i need to get the iconpath from the SBApplication.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

(り薆情海 2025-01-01 06:13:09

我认为使用 C SpringBoadServices 函数可能更容易。进入 Xcode 根文件夹,找到 iOS 模拟器平台的私有框架 SpringBoardServices。将其设置为当前目录并在可执行文件上运行nm

imac-van-ief2:SpringBoardServices.framework ief2$ pwd
/Applications/Xcode 3.2.6/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/SpringBoardServices.framework
imac-van-ief2:SpringBoardServices.framework ief2$ nm -g SpringBoardServices | grep SBSCopyIcon
00009548 T _SBSCopyIconImagePNGDataForDisplayIdentifier
00009400 T _SBSCopyIconImagePathForDisplayIdentifier

现在你已经找到了图标路径函数名,你可以调用它了。将其声明为extern,您就可以这样做。

extern NSString *SBSCopyIconImagePathForDisplayIdentifier(NSString *);

myPath = SBSCopyIconImagePathForDisplayIdentifier(@"com.apple.String");
// Do anything you like
[myPath release];

现在,不要忘记将最终的可执行文件链接到 SpringBoardServices 框架,并将 /System/Library/PrivateFrameworks 添加到您的框架搜索路径。

I think it might be easier to use the C SpringBoadServices functions. Go to your Xcode root folder and find the private framework SpringBoardServices of the iOS simulator platform. Set it as the current directory and run nm on the executable.

imac-van-ief2:SpringBoardServices.framework ief2$ pwd
/Applications/Xcode 3.2.6/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/SpringBoardServices.framework
imac-van-ief2:SpringBoardServices.framework ief2$ nm -g SpringBoardServices | grep SBSCopyIcon
00009548 T _SBSCopyIconImagePNGDataForDisplayIdentifier
00009400 T _SBSCopyIconImagePathForDisplayIdentifier

Now you've found the icon path function name, you can call it. Declare it as extern and you'll be able to do so.

extern NSString *SBSCopyIconImagePathForDisplayIdentifier(NSString *);

myPath = SBSCopyIconImagePathForDisplayIdentifier(@"com.apple.String");
// Do anything you like
[myPath release];

Now, don't forget to link your final executable to the SpringBoardServices framework and to add /System/Library/PrivateFrameworks to your framework search path.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文