1

我想在越狱应用程序中以编程方式更改 iPhone 的消息通知首选项。可以使用任何私有API,并且该应用程序不适用于AppStore,因此请不要说“应用程序不会被Apple批准”

如何关闭传入消息的通知?

4

1 回答 1

0

添加到您的应用程序权利com.apple.bulletinboard.settings键,布尔值等于YES. 链接到私有 BulletinBoard.framework。它包含所有必需的类。

我们将使用一个实例BBSettingsGateway

BBSettingsGateway* settings = [[BBSettingsGateway alloc] init];

获取所有通知首选项

[settings getSectionInfoWithCompletion:^(NSArray* sections){
}];

sections将包含BBSectionInfo对象数组。他们sectionID的属性包含目标应用程序的包 ID。搜索com.apple.MobileSMS以查找消息应用首选项。

BBSectionInfo包含所有通知首选项。例如,您可以像这样禁用所有通知

messagesAppSectionInfo.showsInNotificationCenter = NO;

应用更改

[settings setSectionInfo:messagesAppSectionInfo forSectionID:@"com.apple.MobileSMS"];

并完整示例禁用消息应用程序的所有通知:

BBSettingsGateway* settings = [[BBSettingsGateway alloc] init];
[settings getSectionInfoWithCompletion:^(NSArray* sections){
    for (BBSectionInfo* info in sections)
    {
        if ([info.sectionID isEqualToString:@"com.apple.MobileSMS"])
        {
            info.showsInNotificationCenter = NO;
            [settings setSectionInfo:info forSectionID:@"com.apple.MobileSMS"];
            break;
        }
    }
}];
于 2013-07-05T09:19:01.753 回答