分析步骤:略
解决办法:重写系统获取devicename的方法,不返回itouch即可
具体代码
UIDevice+YYY.h
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIDevice (YYY)
@end
NS_ASSUME_NONNULL_END
UIDevice+YYY.m
#import "UIDevice+YYY.h"
#import <objc/runtime.h>
@implementation UIDevice (YYY)
+ (void)load{
{
Method originalMethod = class_getInstanceMethod([UIDevice class], @selector(modelS));
Method swizzledMethod = class_getInstanceMethod([UIDevice class], @selector(model));
method_exchangeImplementations(originalMethod, swizzledMethod);
}
{
Method originalMethod = class_getInstanceMethod([UIDevice class], @selector(localizedModelS));
Method swizzledMethod = class_getInstanceMethod([UIDevice class], @selector(localizedModel));
method_exchangeImplementations(originalMethod, swizzledMethod);
}
}
- (NSString *)modelS{
NSString *str = [self modelS];
if ([str containsString:@"iPod"]) {
return @"Created by on 2032/13/2";
}else{
return str;
}
}
- (NSString *)localizedModelS{
NSString *str = [self localizedModelS];
if ([str containsString:@"iPod"]) {
return @"Created by on 2032/13/2";
}else{
return str;
}
}
@end