Bogdan's blog

modding Mi Home on iOS to unlock China region-locked devices

okay so there's this cool russian mod for Mi Home on Android called vevs. it adds a bunch of stuff but most importantly it removes the restriction that some devices have (such as some versions of the STYJ02YM robot vacuum), but unfortunately it's only available for Android and it seems like there's no equivalent for iOS :(

i wasn't going to let this slight annoyance pass, so i opened up the APK in JADX. after some looking around i figured out that the way the mod works is by hooking the loading of some configuration from the xiaomi servers, and instead using a local copy provided in the APK assets, which presumably contains devices from all regions instead of just the current region. sounds easy enough to replicate

unfortunately decrypting iOS apps so that you can modify them is kind of a pain and requires a jailbroken device. i don't have one of those anymore, but luckily there's this site that lets you download pre-decrypted IPAs, and i even managed to find a Mi Home version that's kinda close to the APK i have. awesome!

now, i never did anything in Objective-C or related to iOS tweaks before, but how complicated could it be? once i found theos-jailed, not very, it seems:

#import <Foundation/Foundation.h>

NSBundle* const kTweakBundle = [NSBundle bundleWithPath:<a href="/nsbundle-mainbundle-pathforresource-vevsmod-oftype-bundle">NSBundle mainBundle] pathForResource:@"vevsmod" ofType:@"bundle"</a>;

%hook MHGetConfigInfoResponse
+ (id)responseWithJSONObject:(id)obj {
	id configData = [NSData dataWithContentsOfFile:[kTweakBundle pathForResource:@"config_all" ofType:@"json"]];
	return %orig([NSJSONSerialization JSONObjectWithData:configData options:0 error:nil]);

build, run, and it works! however i needed to log in again every time i started the app because of some sideloading-related keychain issues, so another fix is needed:

%hook MPKeychainUtil
+ (id)obtainPrivateGroup {
	// return nil so that the default group ID is used
	return nil;

and now everything works fine :) this was quite fun to do and it's nice to finally be able to control my vacuum from my phone instead of having to find a computer and use an Android emulator to run the modded app

i've uploaded the modded version of the iOS app here: ipa download. sideload it using altstore or sideloadly or whatever else you want to use, and enjoy

Recent posts