C SCNetworkReachabilityContext ARC转换

转换应用程序以使用自动引用计数时遇到此错误:

SCNetworkReachabilityContext context = {0, self, NULL, NULL, NULL};

ARC不允许将Objective-C指针隐式转换为“void *”

这会修复编译器错误,但会给出警告:

SCNetworkReachabilityContext context = {0, objc_unretainedPointer(self), NULL, NULL, NULL};

如何摆脱这个警告?

用'objc_objectptr_t'类型的表达式(又名'const void *')初始化'void *'会丢弃限定符


你应该能够将自己(id)投给void *而没有问题。

SCNetworkReachabilityContext context = {0, ( void * )self, NULL, NULL, NULL};
链接地址: http://www.djcxy.com/p/44901.html

上一篇: C SCNetworkReachabilityContext ARC conversion

下一篇: How to make a cookie available to all paths in a domain?