开发者

EXC_BAD_ACCESS accessing an NSMutableData

开发者 https://www.devze.com 2023-03-07 11:35 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消