我在Xcode 4上收到语义警告: *在这个函数之外,'struct sockaddr_in'的声明将不可见* 结构似乎在netinet/in.h中声明
该警告已在Reachability.h上标记,它是我从Apple示例下载的类.
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
typedef enum {
NotReachable = 0,
ReachableViaWiFi,
ReachableViaWWAN
} NetworkStatus;
#define kReachabilityChangedNotification @"kNetworkReachabilityChangedNotification"
@interface Reachability: NSObject
{
BOOL localWiFiRef;
SCNetworkReachabilityRef reachabilityRef;
}
//reachabilityWithHostName- Use to check the reachability of a particular host name.
+ (Reachability*) reachabilityWithHostName: (NSString*) hostName;
//reachabilityWithAddress- Use to check the reachability of a particular IP address.
+ (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
//reachabilityForInternetConnection- checks whether the default route is available.
// Should be used by applications …Run Code Online (Sandbox Code Playgroud) 使用时Reachability.h- Apple的代码处理iOS上的连接:
+ (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
Run Code Online (Sandbox Code Playgroud)
我收到以下警告:
Declaration of 'struct sockaddr_in' will not be visible outside of this function
Run Code Online (Sandbox Code Playgroud)