3 回答

TA貢獻1810條經驗 獲得超4個贊
這一切都可以輕松完成,但會被蘋果公司拒絕。
鈴聲可以通過改變而改變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應用程序之一中使用。對他們來說并沒有太多的東西,但是這些應該可以使您朝正確的方向前進。

TA貢獻1846條經驗 獲得超7個贊
由于iOS的更改,WrightsCS的答案在某些時候停止了工作。不幸的是,如果您想使用未記錄的功能,則必須忍受這些。
如果仍然需要執行此操作,則僅對于非App Store應用程序,此代碼可在iOS 9.3中使用。不過,它可能會在將來的任何iOS版本中停止工作。(請參閱下面的評論:不再在iOS 10中工作)
#import "SBSUIWallpaperPreviewViewController.h"
#import <dlfcn.h>
// open the private framework dynamically
void *handle = dlopen("/System/Library/PrivateFrameworks/SpringBoardUIServices.framework/SpringBoardUIServices", RTLD_NOW);
UIImage *wallpaper = [UIImage imageNamed: @"background.jpg"];
Class sbClass = NSClassFromString(@"SBSUIWallpaperPreviewViewController");
// we create a view controller, but don't display it.
// just use it to load image and set wallpaper
SBSUIWallpaperPreviewViewController *controller = (SBSUIWallpaperPreviewViewController*)[[sbClass alloc] initWithImage: wallpaper];
[controller setWallpaperForLocations: 3]; // 3 -> set both for lock screen and home screen
dlclose(handle);
您需要將私有API標頭添加到您的項目中。通常,您可以通過一些搜索在網上找到這些內容,例如,此處。
另外,在上述的例子中,[SBSUIWallpaperPreviewViewController setWallpaperForLocations:]被調用的3參數:3表示圖像應被用于兩個鎖和主畫面。1表示僅鎖定屏幕。2僅指示主屏幕。
有關為什么我要動態打開此框架的說明,請參見此處的相關答案。
關于鈴聲我沒有答案。這確實應該是一個單獨的問題:完全不同的API在起作用。
- 3 回答
- 0 關注
- 798 瀏覽
添加回答
舉報