nd得到这个错误“链接器命令失败,退出代码1(使用-v来查看调用)”

问题描述:

我使用的是Apple提供的Rechablity.h和Rechablity.h,并使用这些文件并添加了一些代码,如nd得到这个错误“链接器命令失败,退出代码1(使用-v来查看调用)”

#pragma mark Rechability method 

/** 
* reachabilityChanged() 
* @desc Check the internet connection 
* @param NSNotification note is the notification of internet state changed 
*/ 

- (void) reachabilityChanged: (NSNotification*)note { 

Reachability* curReach = [note object]; 
NSParameterAssert([curReach isKindOfClass: [Reachability class]]); 
[self updateInterfaceWithReachability: curReach]; 
} 

/** 
* updateInterfaceWithReachability() 
* @desc Update the internet connection state 
* @param Reachability curReach is the instance of Reachbility 
*/ 

- (void) updateInterfaceWithReachability: (Reachability*) curReach { 

if(curReach == internetReach) { 

    NetworkStatus netStatus = [curReach currentReachabilityStatus]; 
    BOOL connectionRequired = [curReach connectionRequired]; 
    NSString* statusString = @""; 

    switch (netStatus) { 

     case NotReachable: { 

      statusString = @"Access Not Available"; 
      connectionRequired = NO; 
      isInternetAvailable = FALSE; 
      break; 
     } 

     case ReachableViaWWAN: { 

      statusString = @"Reachable WWAN"; 
      isInternetAvailable = TRUE; 
      break; 
     } 

     case ReachableViaWiFi: { 

      statusString = @"Reachable WiFi"; 
      isInternetAvailable = TRUE; 
      break; 
     } 
    } 

    if(connectionRequired) 
     statusString = [NSString stringWithFormat: @"%@, Connection Required", statusString]; 
    //UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Gmmabling Gambit" message:statusString delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Ok",nil]; 
    //  [alert show]; 
    //  [alert release]; 
    //NSLog(@"%@",statusString); 
} 
} 

/** 
* internetCheck() 
* @desc store the internet connection state 
* @return BOOL internet is available or not 
*/ 

- (BOOL)internetCheck { 

return isInternetAvailable; 
} 

新增systemConfiguration.framework和Security.framework 但是当你没有在bundle resources添加.m file有这种类型的错误

clang: error: linker command failed with exit code 1 (use -v to see invocation) 

的这个错误通常出现。 所以你可以交叉检查这些文件是否被添加或者添加实现文件。 您可以将构建阶段做同样的 - >编译资源,然后添加.m文件

让我知道,如果它的工作原理:)

希望这有助于!

+0

在编译资源已经添加 – ASHISHT 2013-02-09 15:08:25

+0

刚刚展开项目,并检查是否有任何文件将从您的项目中失踪(进口库或任何头/执行文件)这个文件(用红色特别强调) – 2013-02-11 04:58:22

+0

最后我得到的解决方案同样感谢大家的支持 ASHISHT 2013-02-11 10:03:25

在构建设置中,使用构建体系结构进行搜索,如果该值为否,则替换为是。可能是作品。你必须改变项目和目标。

+0

不,这不起作用 – ASHISHT 2013-02-09 13:58:18