*’struct sockaddr_in’的声明在此函数之外不可见*
该结构体似乎在netinet / in.h中声明
警告被标记在Reachability.h,它是一个类,我从苹果下载例子。
#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 that do not connect to a particular host+ (Reachability*) reachabilityForInternetConnection;//reachabilityForLocalWiFi- checks whether a local wifi connection is available.+ (Reachability*) reachabilityForLocalWiFi;//Start Listening for reachability notifications on the current run loop- (BOol) startNotifIEr;- (voID) stopNotifIEr;- (NetworkStatus) currentReachabilityStatus;//WWAN may be available,but not active until a connection has been established.//WiFi may require a connection for VPN on Demand.- (BOol) connectionrequired;@end
我不明白警告,有人可以解释一下吗?
谢谢。
有一个快速修复它。只需将以下行添加到Reachability.h:
#import <netinet/in.h>总结
以上是内存溢出为你收集整理的osx – xcode上的语义警告4全部内容,希望文章能够帮你解决osx – xcode上的语义警告4所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)