Search code examples
iosobjective-cipadjailbreaktheos

Theos tweak works on iPhone 5s but not on iPad 3


Few days ago I wrote a tweak that hooks ASIdentifierManager advertisingIdentifier

Here is my Tweak.xm:

#import <AdSupport/ASIdentifierManager.h>

%hook ASIdentifierManager

-(NSUUID*)advertisingIdentifier
{
    //id result = %orig;
    //%log;
    NSUUID *x = [[NSUUID alloc] initWithUUIDString:@"11111111-1111-1111-1111-111111111111"];
    return x;
}

%end

And it works fine on my iphone 5s, but not on my iPad. Probably the problem us that on my iPad i only installed openssh after jailbreak and on my iphone i've lots of stuff installed.

Here is my Makefile

export SDKVERSION=7.1
export ARCHS = armv7 armv7s arm64
export TARGET = iphone:clang:7.1:7.0
export THEOS_DEVICE_IP=192.168.1.121


include theos/makefiles/common.mk

TWEAK_NAME = iHabrTweak
ARCHS = armv7 armv7s arm64
iHabrTweak_FILES = Tweak.xm
iHabrTweak_FRAMEWORKS = UIKit

include $(THEOS_MAKE_PATH)/tweak.mk

My plist

{ Filter = { Bundles = ( "com.apple.UIKit" ); }; }

Solution

  • First, are there any particular applications that it does or doesn't work in? This might be important.

    Second, you will want to change your filter plist to reflect that you'd prefer to load anywhere com.apple.AdSupport is loaded, not com.apple.UIKit. This probably won't change much, as you're probably only targeting GUI-bearing applications (not system services.)

    Is it possible that applications simply aren't calling -[ASIdentifierManager advertisingIdentifier]? Place a %log; at the top of your replacement method and check the syslog to see if it's being called. It may be the case that you're running into applications which rely on the UDID (-[UIDevice uniqueIdentifier]) and still work because they have not been recompiled, or applications which rely on -[UIDevice identifierForVendor].

    Finally, you might like to make sure that Cydia Substrate is installed. It's likely that the tweak won't even install without it (if it has a proper Depends field), but you never know.