iPhone可达课程 [英] iPhone Reachable classes

查看:90
本文介绍了iPhone可达课程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了两个文件Reachability.h/m. 我遇到的问题是ReachabilityCallback方法

I have added the two files Reachability.h/m. The problem I am having is in the ReachabilityCallback method

NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback");

错误消息是:将C指针类型"void *"强制转换为Objective-C指针类型"NSObject *"需要桥接强制转换

The error message is: Cast of C pointer type 'void *' to Objective-C pointer type 'NSObject * requires a bridged cast

NSAutoreleasePool* myPool = [[NSAutoreleasePool alloc] init];

错误:"NSAutoreleasePool"不可用:在自动引用计数模式下不可用

Error: 'NSAutoreleasePool' is unavailable: not available in automatic reference counting mode

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

错误:ARC不允许将Object-C指针隐式转换为'void *'

Error: Implicit conversion of an Object-C pointer to 'void *' is disallowed with ARC

有一堆ARC禁止显式发送'release'/'autorelease'消息.

There is a bunch of ARC forbids explicit message send of 'release'/'autorelease'.

是否存在适用于ARC的代码版本?

Is there a version of the code that will work for ARC?

谢谢

推荐答案

尝试一下

NSCAssert([(__bridge NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback");

这篇关于iPhone可达课程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆