/*网络监测
File: Reachability.h
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
Version: 2.0.4ddg
*/
/*
Significant additions made by Andrew W. Donoho, August 11, 2009.
This is a derived work of Apple's Reachability v2.0 class.
The below license is the new BSD license with the OSI recommended personalizations.
<http://www.opensource.org/licenses/bsd-license.php>
Extensions Copyright (C) 2009 Donoho Design Group, LLC. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Andrew W. Donoho nor Donoho Design Group, L.L.C.
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY DONOHO DESIGN GROUP, L.L.C. "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
Apple's Original License on Reachability v2.0
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
constitutes acceptance of these terms. If you do not agree with these terms,
please do not use, install, modify or redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and subject
to these terms, Apple grants you a personal, non-exclusive license, under
Apple's copyrights in this original Apple software (the "Apple Software"), to
use, reproduce, modify and redistribute the Apple Software, with or without
modifications, in source and/or binary forms; provided that if you redistribute
the Apple Software in its entirety and without modifications, you must retain
this notice and the following text and disclaimers in all such redistributions
of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may be used
to endorse or promote products derived from the Apple Software without specific
prior written permission from Apple. Except as expressly stated in this notice,
no other rights or licenses, express or implied, are granted by Apple herein,
including but not limited to any patent rights that may be infringed by your
derivative works or by other works in which the Apple Software may be
incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2009 Apple Inc. All Rights Reserved.
*/
/*
DDG extensions include:
Each reachability object now has a copy of the key used to store it in a
dictionary. This allows each observer to quickly determine if the event is
important to them.
-currentReachabilityStatus also has a significantly different decision criteria than
Apple's code.
A multiple convenience test methods have been added.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <netinet/in.h>
#define USE_DDG_EXTENSIONS 1 // Use DDG's Extensions to test network criteria.
// Since NSAssert and NSCAssert are used in this code,
// I recommend you set NS_BLOCK_ASSERTIONS=1 in the release versions of your projects.
enum {
// DDG NetworkStatus Constant Names.
kNotReachable = 0, // Apple's code depends upon 'NotReachable' being the same value as 'NO'.
kReachableViaWWAN, // Switched order from Apple's enum. WWAN is active before WiFi.
kReachableViaWiFi
};
typedef uint32_t NetworkStatus;
enum {
// Apple NetworkStatus Constant Names.
NotReachable = kNotReachable,
ReachableViaWiFi = kReachableViaWiFi,
ReachableViaWWAN = kReachableViaWWAN
};
extern NSString *const kInternetConnection;
extern NSString *const kLocalWiFiConnection;
extern NSString *const kReachabilityChangedNotification;
@interface Reachability: NSObject {
@private
NSString *key_;
SCNetworkReachabilityRef reachabilityRef;
}
@property (copy) NSString *key; // Atomic because network operations are asynchronous.
// Designated Initializer.
- (Reachability *) initWithReachabilityRef: (SCNetworkReachabilityRef) ref;
// Use to check the reachability of a particular host name.
+ (Reachability *) reachabilityWithHostName: (NSString*) hostName;
// Use to check the reachability of a particular IP address.
+ (Reachability *) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
// Use to check whether the default route is available.
// Should be used to, at minimum, establish network connectivity.
+ (Reachability *) reachabilityForInternetConnection;
// Use to check whether a local wifi connection is available.
+ (Reachability *) reachabilityForLocalWiFi;
//Start listening for reachability notifications on the current run loop.
- (BOOL) startNotifier;
- (void) stopNotifier;
// Comparison routines to enable choosing actions in a notification.
- (BOOL) isEqual: (Reachability *) r;
// These are the status tests.
- (NetworkStatus) currentReachabilityStatus;
// The main direct test of reachability.
- (BOOL) isReachable;
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
- (BOOL) isConnectionRequired; // Identical DDG variant.
- (BOOL) connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
- (BOOL) isConnectionOnDemand;
// Is user intervention required?
- (BOOL) isInterventionRequired;
// Routines for specific connection testing by your app.
- (BOOL) isReachableViaWWAN;
- (BOOL) isReachableViaWiFi;
- (SCNetworkReachabilityFlags) reachabilityFlags;
@end
没有合适的资源?快使用搜索试试~ 我知道了~
仿网易新闻客户端(ios开发)
共358个文件
jpg:167个
h:71个
m:71个
4星 · 超过85%的资源 需积分: 9 127 下载量 138 浏览量
2014-03-23
22:08:21
上传
评论 5
收藏 5.62MB ZIP 举报
温馨提示
订阅功能 跟帖功能 图片版块 投票模块 用户注册/登陆模块 收藏模块 跟帖模块 消息模块 离线下载 日间/夜间 搜索新闻 每日吐槽 新闻爆料
资源推荐
资源详情
资源评论
收起资源包目录
仿网易新闻客户端(ios开发) (358个子文件)
.DS_Store 39KB
.DS_Store 12KB
.DS_Store 12KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
Reachability.h 7KB
SBJsonStreamWriter.h 6KB
SBJsonStreamParser.h 5KB
SBJsonStreamParserAdapter.h 5KB
SBJsonWriter.h 4KB
DMMainFrame.h 4KB
SBJsonParser.h 3KB
SBJson.h 3KB
DMMainEnter.h 3KB
SBJsonStreamParserState.h 3KB
DMUserModel.h 3KB
SBJsonStreamWriterState.h 2KB
NSObject+SBJson.h 2KB
SBJsonTokeniser.h 2KB
DMTableViewCell.h 2KB
SBJsonUTF8Stream.h 2KB
DMNewsDataModel.h 2KB
SBJsonStreamParserAccumulator.h 2KB
SBJsonStreamWriterAccumulator.h 2KB
DMVideoNews.h 1KB
DMFollowUpVC.h 1KB
DMFollowPaste.h 1KB
DMPictureTitle.h 1KB
DMPublishNews.h 1KB
EGORefreshTableHeaderView.h 1KB
DMComments.h 1KB
DMJSONWonderfulComment.h 1KB
DMTsukkomlVC.h 1KB
DMUserManager.h 1KB
DMCollectCell.h 1KB
DMPictureNews.h 1KB
DMCommentModel.h 1KB
DMJSONParse.h 1KB
DMBasicNews.h 1005B
DMCollectionSave.h 1005B
DMCollectVC.h 954B
ggHttpFounction.h 820B
DMImageInfoModel.h 748B
DMSearchVC.h 745B
DMCommentsCell.h 725B
DMGroupPicture.h 666B
DMAppearObserveModel.h 663B
DMJSONCreate.h 642B
DMLoginLand.h 623B
DMPictureBoardCell.h 622B
DMAlbumCamera.h 606B
DMTailorCommend.h 595B
DMContentModelListModel.h 576B
DMContentCategoryListModel.h 576B
DMAppearObserve.h 575B
DMFollowCardCell.h 566B
DMEnterLand.h 515B
DMLeftRightViewDisplay.h 503B
DMRecommendNews.h 496B
DMProjectNews.h 488B
DMTailorRead.h 436B
DMTailReadCell.h 436B
DMNetWork.h 407B
DMLeaveLine.h 383B
ggPicOperation.h 370B
AppDelegate.h 346B
DMBallot.h 337B
DMPictureNewsModel.h 318B
DMProjectNewsModel.h 295B
DMEdition.h 292B
DMNowTime.h 263B
DMSetRight.h 236B
DMFindCoed.h 235B
DMNightDayVC.h 229B
DMMessageVC.h 217B
DMWeather.h 214B
edition2.jpg 223KB
edition3.jpg 216KB
edition4.jpg 206KB
edition1.jpg 203KB
edition7.jpg 176KB
weatherMarkDay.jpg 175KB
tsukkoml6.jpg 164KB
tsukkoml5.jpg 159KB
tsukkoml4.jpg 158KB
tsukkoml3.jpg 158KB
tsukkoml2.jpg 156KB
tsukkoml1.jpg 155KB
right111.jpg 146KB
messageDay.jpg 137KB
共 358 条
- 1
- 2
- 3
- 4
风浅月明
- 粉丝: 772
- 资源: 152
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页