我在ClassA中拥有方法-(void)test:(NSString *)str
。
当我执行performSelector:@selector(test:) withObject:@"1"
时,参数'str'在调试模式下为“ 1”,但在发布模式下为nil。
有人可以告诉我为什么吗?
您可以这样尝试:
#import "JGJTestViewController.h"
@interface JGJTestViewController ()
@end
@implementation JGJTestViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self performSelector:@selector(test:) withObject:@"1"];
}
- (void)test:(NSString *)str
{
NSLog(@"test====>%@",str);
}