libcephei
libcephei copied to clipboard
HBPreferences does not work in Sandbox app (Dopamine 2.0.11 rootless Jailbreak)
I am developing a Tweak with 'com.apple.corelocation' as the bundle filter.
My environment is as follows:
- iPhone XS Max
- iOS 15.1
- Dopamine 2.0.11 rootless Jailbreak
I want to share settings between multiple apps (more precisely, between my Tweaks associated with each app) and am considering using HBPreferences for this purpose.
However, Read/Write operations with HBPreferences do not function correctly from Tweak apps tied to Sandbox apps.
As a sample implementation, I tried implementing simple settings read and write as follows:
preferences = [[HBPreferences alloc] initWithIdentifier:@"com.test.myapp"];
[preferences setObject:[NSString stringWithFormat:@"%.2f", 100.0] forKey:@"speed"];
double speed = [preferences doubleForKey:@"speed" default:1.0];
With the exact same implementation, For instance, when the Tweak is linked to jailbreak apps like Filza or Sileo, or a jailbreak settings app I created, doubleForKey and setObject can correctly perform read and write operations.
However, when the Tweak is linked to apps downloaded from the App Store, despite the settings values being present in com.test.myapp.plist, doubleForKey always retrieves the default value, and setObject is also ignored.
Is this behavior as per the specifications? Or is there any potential workaround?
I just had this exact same issue, here's the workaround I came up with:
NSDictionary* preferences = [NSDictionary dictionaryWithContentsOfFile:
[NSString stringWithFormat:
@"%s/var/mobile/Library/Preferences/your.tweak.domain.plist",
THEOS_PACKAGE_INSTALL_PREFIX
]
];
if (preferences == nil) preferences = [NSDictionary dictionary];
//then just read keys from the NSDictionary
This assumes you're building with Theos which will automatically define THEOS_PACKAGE_INSTALL_PREFIX
Is this behavior as per the specifications?
Just ran into this issue today. No, it's definitely a bug in Cephei 2.0: https://discord.com/channels/349243932447604736/688124600269144162/1419324031143903233