0
votes

I have a UDP type socket that I created last summer that worked fine, and still runs fine if I open the project file. However I have imported the .h/.m files into a new project, which does have ARC.

ARC does not like the following command(used in an if statement);

CFSocketSendData(WOLsocket, 
                   address,
                   Data,
                   0) < 0)

With the error:

implicit conversion of objective c type pointer 'CFDataRef'(aka 'const struct__CFData' is disallowed with ARC

The error is repeated, once for WOLsocket, and once for address

where WOLsocket is created as follows;

WOLsocket = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_DGRAM, IPPROTO_UDP, 0, NULL, NULL);
int desc = -1;
desc = CFSocketGetNative(WOLsocket);
int yes = 1;
setsockopt (desc, SOL_SOCKET, SO_BROADCAST, (char *)&yes, sizeof (yes))

(There is error checking code, this is the bare basics!)

and address is created as so;

memset(&addr, 0, sizeof(addr));
    addr.sin_len = sizeof(addr);
    addr.sin_family = AF_INET;
    addr.sin_port = htons(PORT); //port
    addr.sin_addr.s_addr = ad;
    address = [NSData dataWithBytes: &addr length: sizeof(addr)];

I am very confused as to why this is happening, all other ARC errors seemed to be solved by lossing the 'dealloc, release' statements!

So my question is, How do I get ARC to stop complaining about my use of CFData? (What modifications do I need to make?)

Thanks,

Alex

1

1 Answers

0
votes

Both the question and chosen answer to ARC and bridged cast should answer your question pretty well.