ios - 如何在 iPhone 中以编程方式设置锁屏、墙纸和铃声?

标签 ios objective-c iphone ios4 iphone-privateapi

在 iPhone 中,我们可以通过编程方式设置锁屏、壁纸和铃声吗?

如果,请告诉我如何设置它们?

最佳答案

这一切都可以轻松完成,但会被 Apple 拒绝。

可以通过更改 com.apple.SpringBoard.plist 来更改铃声,特别是 ringtone 键。

以下代码可用于读取自定义铃声(由iTunes同步)的实际铃声标题。

NSMutableDictionary *custDict = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/private/var/mobile/Media/iTunes_Control/iTunes/Ringtones.plist"];
NSMutableDictionary *dictionary = [custDict objectForKey:@"Ringtones"];

NSArray *keys = [dictionary allKeys];
id key = [keys objectAtIndex:indexPath.row];
NSMutableDictionary *customRingtone = [dictionary objectForKey:key];
NSString *name = [customRingtone objectForKey:@"Name"];
cell.textLabel.text = name;

可以在以下位置覆盖壁纸:

NSString *homePath1 = @"/private/var/mobile/Library/SpringBoard/HomeBackground.jpg";
NSString *homePath2 = @"/private/var/mobile/Library/SpringBoard/HomeBackgroundPortrait.jpg";
NSString *lockPath1 = @"/private/var/mobile/Library/SpringBoard/LockBackground.jpg";
NSString *lockPath2 = @"/private/var/mobile/Library/SpringBoard/LockBackgroundPortrait.jpg";

我的一个 Cydia 应用程序中使用了这些示例。它们实际上并没有更多,但这些应该会让您朝着正确的方向前进。

关于ios - 如何在 iPhone 中以编程方式设置锁屏、墙纸和铃声?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4476777/

相关文章:

iphone - 将新图像加载到 UIImageView 中,之前图像的内存不会被释放

ios - UIPickerView 和 UIDatePicker 没有响应交互

ios - 由于未捕获的异常 'NSInternalInconsistencyException' 而终止应用程序,原因 : 'Could not load NIB in bundle

iphone - 如何通过单击按钮更改数字时钟的时间格式?

ios - 如何为自定义 UITableView 标题部分 Nib 添加分隔线?

ios - Cocoa:在运行时获取 Darwin 版本

iphone - 访问 navcontroller iphone 的 rootviewController 时出现问题

ios - SWRevealController 滑动手势

ios - 如何取消选中tableView中的选中行

ios - 出于某种原因尝试创建自定义 UITableView 和单元格显示条形图