MichaelMKenny/ios-13-light-dark-wallpaper-app

Creating a Tweak on Jailbroken Device

p2kdev opened this issue · 0 comments

I am trying to create a tweak in theos to utilize the SBSUIWallpaperSetImages symbol , but I get null from the dlsym function. Is there a specific entitlement required when jailbroken to get this working?

        void *sbsUILib = dlopen("/System/Library/PrivateFrameworks/SpringBoardUIServices.framework", RTLD_LAZY);
        int (*_SBSUIWallpaperSetImages)(id imageDict, id optionsDict, int locations, int interfaceStyle) = (int (*)(id imageDict, id optionsDict, int locations, int interfaceStyle)) dlsym(sbsUILib, "SBSUIWallpaperSetImages");
        _SBSUIWallpaperSetImages(@{@"light": newResizedImage, @"dark": newResizedImage},
                          @{@"light": lightOptions, @"dark": darkOptions},
                         (int)whereToApply,
                         UIUserInterfaceStyleDark);

Any help will be greatly appreciated as before iOS13, I was using the following code & it was working fine to change wallpapers, but on iOS13 this code causes the springboard to freeze/crash

          PLStaticWallpaperImageViewController *wallpaperController = [[PLStaticWallpaperImageViewController alloc] initWithUIImage:newResizedImage];

          object_setInstanceVariable(wallpaperController, "_wallpaperMode", 2);
          [wallpaperController _savePhoto];
          [wallpaperController setWallpaperForLocations:2];