如果我不设置断点,将获得 EXC_BAD_access
Getting a EXC_BAD_access if I don't put a breakpoint
我得到了 EXC_BAD_access 这个代码
_emailID = [NSMutableString stringWithString:self.txtEmail.text];
_password = [NSMutableString stringWithString:self.txtPassword.text];
NSDictionary *params = @{@"email" : _emailID, @"password" : _password, @"device" : @"iOS"};
我已经启用僵尸模式,这就是我得到的
Thread 1: EXC_BREAKPOINT (code=EXC_i386_BPT, subcode=0x0) error
但是当我在 _emailID 行上放置一个断点并手动转到下一行时,它根本不会抛出错误
//View.h
@property (nonatomic, assign) NSMutableString *emailID;
@property (nonatomic, assign) NSMutableString *password;
//View.m
@synthesize emailID;
@synthesize password;
我试过你的代码,当我尝试打印字典时崩溃了。
我尝试像这样更改 属性 来解决此崩溃问题
@property (nonatomic, strong) NSMutableString *emailID;
@property (nonatomic, strong) NSMutableString *password;
其他代码如下
@synthesize emailID;
@synthesize password;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
emailID = [NSMutableString stringWithString:self.tfEmail.text];
password = [NSMutableString stringWithString:self.tfPassword.text];
NSDictionary *params = @{@"email" : emailID, @"password" : password, @"device" : @"iOS"};
NSLog(@"%@",params);
}
而且有效!!
我得到了 EXC_BAD_access 这个代码
_emailID = [NSMutableString stringWithString:self.txtEmail.text];
_password = [NSMutableString stringWithString:self.txtPassword.text];
NSDictionary *params = @{@"email" : _emailID, @"password" : _password, @"device" : @"iOS"};
我已经启用僵尸模式,这就是我得到的
Thread 1: EXC_BREAKPOINT (code=EXC_i386_BPT, subcode=0x0) error
但是当我在 _emailID 行上放置一个断点并手动转到下一行时,它根本不会抛出错误
//View.h
@property (nonatomic, assign) NSMutableString *emailID;
@property (nonatomic, assign) NSMutableString *password;
//View.m
@synthesize emailID;
@synthesize password;
我试过你的代码,当我尝试打印字典时崩溃了。
我尝试像这样更改 属性 来解决此崩溃问题
@property (nonatomic, strong) NSMutableString *emailID;
@property (nonatomic, strong) NSMutableString *password;
其他代码如下
@synthesize emailID;
@synthesize password;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
emailID = [NSMutableString stringWithString:self.tfEmail.text];
password = [NSMutableString stringWithString:self.tfPassword.text];
NSDictionary *params = @{@"email" : emailID, @"password" : password, @"device" : @"iOS"};
NSLog(@"%@",params);
}
而且有效!!