我使用的是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)
在編譯資源已經添加 – ASHISHT 2013-02-09 15:08:25
剛剛展開項目,並檢查是否有任何文件將從您的項目中失蹤(進口庫或任何頭/執行文件)這個文件(用紅色特別強調) – 2013-02-11 04:58:22
最後我得到的解決方案同樣感謝大家的支持<3 – ASHISHT 2013-02-11 10:03:25