iOS development SDK how to bypass third-party verification of the BundleID

Some third-party SDK in development will BundleID do check.

For example, if the high moral map BundleID not registered will not be able to obtain the latitude and longitude and reverse geocoding.

For example biometric SDK can not use their turn biometric authentication.

But BundleID package of testing due to some limitations or restrictions can not use the Certificates registered in BundleID pack, how to do it.

1, find BundleID third party sdk is obtained by a method which system

比如我们的是 NSBundle 的 bundleIdentifier 属性

2. The first step is to find a method by which a third party sdk method call

比如我们的是第三方SDK初始化的时候  [ShengWuSDK getInstanceShengWu];

3, before and after the call to the second step of the method are tagged, to return the correct BundleID and returns the actual BundleID

        Global_Variables.isNeedHook = YES;
        [ShengWuSDK getInstanceShengWu];
        Global_Variables.isNeedHook = NO;

4 Add categories alternative method bundleIdentifier NSBundle

.h
#import <Foundation/Foundation.h>

@interface NSBundle (swizz)

@end


.m
#import "NSBundle+swizz.h"

@implementation NSBundle (swizz)

+ (void)load{
    Method originalMethod = class_getInstanceMethod([NSBundle class], @selector(bundleIdentifierSw));
    Method swizzledMethod = class_getInstanceMethod([NSBundle class], @selector(bundleIdentifier));
    method_exchangeImplementations(originalMethod, swizzledMethod);
}
- (NSString *)bundleIdentifierSw{
    if (GlobalVariables.isNeedHook == YES) {
        return @"注册过的";
    }else{
        return [self bundleIdentifierSw];
    }
}
@end

 

 

 

ok

Published 120 original articles · won praise 15 · views 170 000 +

Guess you like

Origin blog.csdn.net/qq_15509071/article/details/82901337