Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 8: 'objc_unretainedPointer' is unavailable use a __bridge cast instead

Tags:

ios

xcode8

Just updated my project to Xcode 8 and I find this errors in multiple external frameworks my app includes. Is there a workaround, maybe touching settings, to avoid this compilation errors?

This is an error example: (That I'm not able to modify because it's an imported framework)

const void * ivarPtr = objc_unretainedPointer(self) + ivar_getOffset(ivar);
[decoder decodeValueOfObjCType:[ivarInfo[@"encoding"] UTF8String] at:(void *)ivarPtr];
like image 363
tonik12 Avatar asked Jun 14 '16 08:06

tonik12


2 Answers

For Xcode 8, it should be:

const void * ivarPtr = (__bridge void *)(self) + ivar_getOffset(ivar);
like image 60
Jin Avatar answered Nov 18 '22 22:11

Jin


You can Simply Replace objc_unretainedPointer(self) to (__bridge void *)(self)

like image 33
Dheeraj D Avatar answered Nov 18 '22 23:11

Dheeraj D