I want to know how I can pass a pointer to a struct to a custom init method of nsoperation. It seems to expect to be passed an item of type ID.
Is this possible to do?
typedef struct mystruct
{
int a;
int b;
}mystruct;
mystruct myitem;
MyNSOperation *op=[[MyNSOperation alloc]initwithdata:myitem]; //can't do this, not of type id
-(id)initwithdata:(mystruct *)thestruct
{
}
If you want to pass a struct as an object, you can use NSData
and get it back to a struct with
This is not architecture independent.