【发布时间】:2011-10-09 18:52:29
【问题描述】:
第一次遇到此错误,我环顾四周,找不到帮助我的解决方案,我已清理我的构建并检查以确保我正在编译最新固件。
这发生在我厌倦了实施我在 here 上找到的可达性解决方案之后 我导入了两个可达性文件 (.m/.h),然后将此代码添加到 .m 文件中并在 .m 文件中声明了 t。 h 的可达性文件
-(BOOL)reachable {
Reachability*r =[Reachability reachabilityWithHostName:@"enbr.co.cc"];
NetworkStatus internetStatus =[r currentReachabilityStatus];
if(internetStatus ==NotReachable){
return NO;
}
return YES;}
之后,我从我的两个 viwcontrollers viewwillappear 方法中调用了该函数,就像这样..
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
//-- Check Reachability START ---->
Reachability *reach = [[Reachability alloc] init];
if ([reach reachable]) {
NSLog(@"Reachable");
}
else {
NSLog(@"Not Reachable");
}
//-- Check Reachability END ---->
}
在我尝试在模拟器中构建和运行之前没有产生错误。这是我收到的错误:(
Ld /Users/imac/Library/Developer/Xcode/DerivedData/wizcode-ccyrqptvfsabmbahgxartbvxwurq/Build/Products/Debug-iphonesimulator/wizcode.app/wizcode 普通 i386 cd "/Users/imac/Documents/Iphone 应用程序/wizsanCode/wizsanCode.5/wizcode" setenv MACOSX_DEPLOYMENT_TARGET 10.6 设置环境路径 "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/imac/Library/Developer/Xcode/DerivedData/wizcode-ccyrqptvfsabmbahgxartbvxwurq/Build/Products/Debug-iphonesimulator -F/Users/imac/Library/Developer/Xcode/DerivedData/wizcode-ccyrqptvfsabmbahgxartbvxwurq/Build/Products/Debug-iphonesimulator -文件列表 /Users/imac/Library/Developer/Xcode/DerivedData/wizcode-ccyrqptvfsabmbahgxartbvxwurq/Build/Intermediates/wizcode.build/Debug-iphonesimulator/wizcode.build/Objects-normal/i386/wizcode.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -lz -framework CoreGraphics -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework UIKit -framework 基础-o /Users/imac/Library/Developer/Xcode/DerivedData/wizcode-ccyrqptvfsabmbahgxartbvxwurq/Build/Products/Debug-iphonesimulator/wizcode.app/wizcode
ld:重复符号 _OBJC_IVAR__Reachability.reachabilityRef 在 /Users/imac/Library/Developer/Xcode/DerivedData/wizcode-ccyrqptvfsabmbahgxartbvxwurq/Build/Intermediates/wizcode.build/Debug-iphonesimulator/wizcode.build/Objects-normal/i386/Reachability-183E2D17A6B26176.o 和 /Users/imac/Library/Developer/Xcode/DerivedData/wizcode-ccyrqptvfsabmbahgxartbvxwurq/Build/Intermediates/wizcode.build/Debug-iphonesimulator/wizcode.build/Objects-normal/i386/Reachability-183E2D17A6B26176.o 对于架构 i386 collect2:ld 返回 1 退出状态命令 /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 退出代码 1 ld 失败:重复符号 _OBJC_IVAR__$_Reachability.reachabilityRef 在 /Users/imac/Library/Developer/Xcode/DerivedData/wizcode-ccyrqptvfsabmbahgxartbvxwurq/Build/Intermediates/wizcode.build/Debug-iphonesimulator/wizcode.build/Objects-normal/i386/Reachability-183E2D17A6B26176.o 和 /Users/imac/Library/Developer/Xcode/DerivedData/wizcode-ccyrqptvfsabmbahgxartbvxwurq/Build/Intermediates/wizcode.build/Debug-iphonesimulator/wizcode.build/Objects-normal/i386/Reachability-183E2D17A6B26176.o 对于架构 i386
命令 /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 退出代码 1 失败
【问题讨论】: