类似于这种写法的反射:
[[PGYGetMAC sendMessage] gotoDownLoad:@"778324728" url:@"https://itunes.apple.com/cn/app/sao-yi-sao-er-wei-ma/id778324728?mt=8"];
这样的话就只需要写一个方法就行,不用写一个类方法.一个实例方法两个方法了
+ (void)cyGotoDownLoad:(NSString *)appID url:(NSString *)url
{
Class myGetMAC = NSClassFromString(@"PGYGetMAC");
if (myGetMAC)
{
id messageInstance = [myGetMAC performSelector:@selector(sendMessage)];
if (messageInstance) {
[messageInstance performSelector:@selector(gotoDownLoad:url:) withObject:appID withObject:url];
}
else
{
NSLog(@"CYPGYGetMAC: mac地址统计失败,sendMessage实例获取失败");
}
}
else
{
NSLog(@"CYPGYGetMAC: mac地址统计失败,请添加libPGY_ANALYTICS_INTERNAL.a");
}
}