在iOS5中需要ARC的可达性版本 [英] Need Reachability version for ARC in iOS5

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

问题描述

在iOS5中使用Apple的Reachability代码我收到一堆编译错误,如下所示。关于这里发生了什么的任何想法?我正在使用ARC所以我稍微编辑了标准代码以删除 autorelease / retain NSAutoReleasePool

Using Apple's Reachability code in iOS5 I get a bunch of compilation errors as shown below. Any ideas on what is happening here? I'm using ARC so I have edited the standard code slightly to remove autorelease/retain and the NSAutoReleasePool.


架构armv7的未定义符号:

Undefined symbols for architecture armv7:

_ SCNetworkReachabilityCreateWithAddress,引自:
+ [可达性reachabilityWithAddress:]在Reachability.o

"_SCNetworkReachabilityCreateWithAddress", referenced from: +[Reachability reachabilityWithAddress:] in Reachability.o

_ SCNetworkReachabilityCreateWithName,引自:
+ [Reachability reachabilityWithHostName:]在Reachability.o中

"_SCNetworkReachabilityCreateWithName", referenced from: +[Reachability reachabilityWithHostName:] in Reachability.o

_ SCNetworkReachabilityUnscheduleFromRunLoop,引自:
- Reachability.o中的[Reachability stopNotifier]

"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from: -[Reachability stopNotifier] in Reachability.o

_ SCNetworkReachabilityScheduleWithRunLoop ,引自:
- Reachability.o中的[Reachability startNotifier]

"_SCNetworkReachabilityScheduleWithRunLoop", referenced from: -[Reachability startNotifier] in Reachability.o

_ SCNetworkReachabilitySetCallback,引自:
- [Reachability startNotifier] in Reachability.o

"_SCNetworkReachabilitySetCallback", referenced from: -[Reachability startNotifier] in Reachability.o

_ SCNetworkReachabili tyGetFlags,引自:
- [Reachability connectionRequired] in Reachability.o
- [Reachability currentReachabilityStatus] in Reachability.o

"_SCNetworkReachabilityGetFlags", referenced from: -[Reachability connectionRequired] in Reachability.o -[Reachability currentReachabilityStatus] in Reachability.o

ld:symbol (s)找不到架构armv7 clang:错误:链接器
命令失败,退出代码为1(使用-v查看调用)

ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

有没有人在iOS5下为ARC提供可行的可达性代码?

Does anyone have workable Reachability code for ARC under iOS5?

推荐答案

我为ARC和iOS5编写了一个干净的'drop in'版本的可达性 - 你可以在这里找到它: https://github.com/tonymillion/Reachability

I wrote a clean 'drop in' version of reachability for ARC and iOS5 - you can get it here: https://github.com/tonymillion/Reachability

这篇关于在iOS5中需要ARC的可达性版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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