第一次遇到这个错误,我环顾四周,找不到帮助我的解决方案,我已经清理了我的构建并检查以确保我正在编译最新的固件。
这发生在我厌倦了实现我在这里找到的可达性解决方案之后 我导入了两个可达性文件 (.m/.h) 然后将此代码添加到 .m 文件中并在 . 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 normal i386 cd "/Users/imac/Documents/Iphone applications/wizsanCode/wizsanCode.5 /wizcode" setenv MACOSX_DEPLOYMENT_TARGET 10.6 setenv PATH "/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 -filelist /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 Foundation -o /Users/imac/Library/Developer/Xcode/DerivedData/wizcode-ccyrqptvfsabmbahgxartbvxwurq/Build/Products /Debug-iphonesimulator/wizcode.app/wizcode
ld:在/Users/imac/Library/Developer/Xcode/DerivedData/wizcode-ccyrqptvfsabmbahgxartbvxwurq/Build/Intermediates/wizcode.build/Debug-iphonesimulator/wizcode.build/Objects-normal/i386/Reachability中重复符号_OBJC_IVAR_$_Reachability.reachabilityRef -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/库/开发人员/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