我在啓用了ARC的Objective-C項目中包含了庫的頭文件。在啓用ARC的情況下使用reinterpret_cast
我知道庫不編譯啓用ARC,但問題是庫的頭文件,特別是這些行:
template <typename Type_>
static inline Type_ &MSHookIvar(id self, const char *name) {
Ivar ivar(class_getInstanceVariable(object_getClass(self), name));
void *pointer(ivar == NULL ? NULL : reinterpret_cast<char *>(self) + ivar_getOffset(ivar));
return *reinterpret_cast<Type_ *>(pointer);
}
我得到這個錯誤:
Cast of an Objective-C pointer to 'char *' is disallowed with ARC
是有可能解決這個錯誤?
整個頭文件可以在這裏找到:http://puu.sh/sTrH
這是不可能投objc變種類型和C類型的變種。 – Feo
嘗試使用'void * self'。 – Feo
你設法解決它嗎? – Osa