Reputation: 1890
I'm trying to convert my code to Objective-C ARC and get several errors.
1.:
NSBezierPath *path = [NSBezierPath bezierPath];
CGPathApply(pathRef, path, CGPathCallback); //error
It says: Implicit conversion of an Objective.C pointer to 'void *' is disallowed with ARC
2.:
static void CGPathCallback(void *info, const CGPathElement *element) {
NSBezierPath *path = info; //error
[…] }
It says: Implicit conversion of a non-Objective-C pointer type 'void *' to 'NSBezierPath *' is disallowed with ARC
Any ideas, how I can resolve the problems?
Upvotes: 2
Views: 3546
Reputation: 185811
You need to use bridged casts. In this case, you just want the simple __bridge
modifier, e.g.
NSBezierPath *path = [NSBezierPath bezierPath];
CGPathApply(pathRef, (__bridge void *)path, CGPathCallback);
and
static void CGPathCallback(void *info, const CGPathElement *element) {
NSBezierPath *path = (__bridge NSBezierPath*)info;
...
}
Upvotes: 7