EXC_BAD_ACCESS accessing an NSMutableData
I´m getting an EXC_BAD_ACCESS when I trying to acces to the data, I suppose it is because I trying to acces to the internal data, but I don´t know How to solve this, the code:
//data->NSMutableData
int identi;
[data getBytes:&开发者_如何学编程;identi];
NSLog(@"identificador: %i",identi);
According to documentation,
Deprecated in Mac OS X v10.6. This method is unsafe because it could potentially cause buffer overruns. You should use getBytes:length: or getBytes:range: instead.
The method is,
- (void)getBytes:(void *)buffer
Parameters: buffer
A buffer into which to copy the receiver's data. The buffer must be at least length bytes.
You are trying to save the receiver data into identi
, a int value.
精彩评论