From 4833dcada0cddb503130e98a9aa2a33c086e84d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=E4=BA=86=E4=B8=AAJ?= Date: Thu, 19 Oct 2017 17:21:21 +0800 Subject: [PATCH] remove @available and warnings 1.remove @available 2.remove warnings 3.fix block parameters --- MJRefresh.podspec | 2 +- MJRefresh/Base/MJRefreshComponent.h | 10 +++++----- MJRefresh/Base/MJRefreshComponent.m | 4 ++-- MJRefresh/UIScrollView+MJExtension.m | 15 +++++++++------ MJRefreshExample.xcodeproj/project.pbxproj | 2 +- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/MJRefresh.podspec b/MJRefresh.podspec index c013dcc7..51bde286 100644 --- a/MJRefresh.podspec +++ b/MJRefresh.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'MJRefresh' - s.version = '3.1.14' + s.version = '3.1.14.1' s.summary = 'An easy way to use pull-to-refresh' s.homepage = 'https://github.com/CoderMJLee/MJRefresh' s.license = 'MIT' diff --git a/MJRefresh/Base/MJRefreshComponent.h b/MJRefresh/Base/MJRefreshComponent.h index f8adf4ef..46e10684 100644 --- a/MJRefresh/Base/MJRefreshComponent.h +++ b/MJRefresh/Base/MJRefreshComponent.h @@ -29,11 +29,11 @@ typedef NS_ENUM(NSInteger, MJRefreshState) { }; /** 进入刷新状态的回调 */ -typedef void (^MJRefreshComponentRefreshingBlock)(); +typedef void (^MJRefreshComponentRefreshingBlock)(void); /** 开始刷新后的回调(进入刷新状态后的回调) */ -typedef void (^MJRefreshComponentbeginRefreshingCompletionBlock)(); +typedef void (^MJRefreshComponentbeginRefreshingCompletionBlock)(void); /** 结束刷新后的回调 */ -typedef void (^MJRefreshComponentEndRefreshingCompletionBlock)(); +typedef void (^MJRefreshComponentEndRefreshingCompletionBlock)(void); /** 刷新控件的基类 */ @interface MJRefreshComponent : UIView @@ -59,14 +59,14 @@ typedef void (^MJRefreshComponentEndRefreshingCompletionBlock)(); #pragma mark - 刷新状态控制 /** 进入刷新状态 */ - (void)beginRefreshing; -- (void)beginRefreshingWithCompletionBlock:(void (^)())completionBlock; +- (void)beginRefreshingWithCompletionBlock:(void (^)(void))completionBlock; /** 开始刷新后的回调(进入刷新状态后的回调) */ @property (copy, nonatomic) MJRefreshComponentbeginRefreshingCompletionBlock beginRefreshingCompletionBlock; /** 结束刷新的回调 */ @property (copy, nonatomic) MJRefreshComponentEndRefreshingCompletionBlock endRefreshingCompletionBlock; /** 结束刷新状态 */ - (void)endRefreshing; -- (void)endRefreshingWithCompletionBlock:(void (^)())completionBlock; +- (void)endRefreshingWithCompletionBlock:(void (^)(void))completionBlock; /** 是否正在刷新 */ @property (assign, nonatomic, readonly, getter=isRefreshing) BOOL refreshing; //- (BOOL)isRefreshing; diff --git a/MJRefresh/Base/MJRefreshComponent.m b/MJRefresh/Base/MJRefreshComponent.m index 8c04df5b..673e02fb 100644 --- a/MJRefresh/Base/MJRefreshComponent.m +++ b/MJRefresh/Base/MJRefreshComponent.m @@ -161,7 +161,7 @@ - (void)beginRefreshing } } -- (void)beginRefreshingWithCompletionBlock:(void (^)())completionBlock +- (void)beginRefreshingWithCompletionBlock:(void (^)(void))completionBlock { self.beginRefreshingCompletionBlock = completionBlock; @@ -174,7 +174,7 @@ - (void)endRefreshing self.state = MJRefreshStateIdle; } -- (void)endRefreshingWithCompletionBlock:(void (^)())completionBlock +- (void)endRefreshingWithCompletionBlock:(void (^)(void))completionBlock { self.endRefreshingCompletionBlock = completionBlock; diff --git a/MJRefresh/UIScrollView+MJExtension.m b/MJRefresh/UIScrollView+MJExtension.m index c0c92379..f6ad4b83 100644 --- a/MJRefresh/UIScrollView+MJExtension.m +++ b/MJRefresh/UIScrollView+MJExtension.m @@ -10,15 +10,17 @@ #import "UIScrollView+MJExtension.h" #import -#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) +#define SYSTEM_VERSION_GREATER_NOT_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability-new" @implementation UIScrollView (MJExtension) - (UIEdgeInsets)mj_inset { #ifdef __IPHONE_11_0 - if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) { + if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) { return self.adjustedContentInset; } #endif @@ -30,7 +32,7 @@ - (void)setMj_insetT:(CGFloat)mj_insetT UIEdgeInsets inset = self.contentInset; inset.top = mj_insetT; #ifdef __IPHONE_11_0 - if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) { + if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) { inset.top -= (self.adjustedContentInset.top - self.contentInset.top); } #endif @@ -47,7 +49,7 @@ - (void)setMj_insetB:(CGFloat)mj_insetB UIEdgeInsets inset = self.contentInset; inset.bottom = mj_insetB; #ifdef __IPHONE_11_0 - if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) { + if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) { inset.bottom -= (self.adjustedContentInset.bottom - self.contentInset.bottom); } #endif @@ -64,7 +66,7 @@ - (void)setMj_insetL:(CGFloat)mj_insetL UIEdgeInsets inset = self.contentInset; inset.left = mj_insetL; #ifdef __IPHONE_11_0 - if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) { + if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) { inset.left -= (self.adjustedContentInset.left - self.contentInset.left); } #endif @@ -81,7 +83,7 @@ - (void)setMj_insetR:(CGFloat)mj_insetR UIEdgeInsets inset = self.contentInset; inset.right = mj_insetR; #ifdef __IPHONE_11_0 - if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) { + if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) { inset.right -= (self.adjustedContentInset.right - self.contentInset.right); } #endif @@ -141,3 +143,4 @@ - (CGFloat)mj_contentH return self.contentSize.height; } @end +#pragma clang diagnostic pop diff --git a/MJRefreshExample.xcodeproj/project.pbxproj b/MJRefreshExample.xcodeproj/project.pbxproj index d4047318..f1c14edf 100644 --- a/MJRefreshExample.xcodeproj/project.pbxproj +++ b/MJRefreshExample.xcodeproj/project.pbxproj @@ -64,7 +64,7 @@ 2D9DF47B1F7CE2F90042D6DD /* MJRefreshNormalHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DB2EA0A1BECBE6700D58F6A /* MJRefreshNormalHeader.m */; }; 2D9DF47C1F7CE2F90042D6DD /* MJRefreshStateHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DB2EA0C1BECBE6700D58F6A /* MJRefreshStateHeader.m */; }; 2D9DF47D1F7CE2F90042D6DD /* MJRefreshConst.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DB2EA101BECBE6700D58F6A /* MJRefreshConst.m */; }; - 2D9DF47E1F7CE2F90042D6DD /* UIScrollView+MJExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DB2EA121BECBE6700D58F6A /* UIScrollView+MJExtension.m */; }; + 2D9DF47E1F7CE2F90042D6DD /* UIScrollView+MJExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DB2EA121BECBE6700D58F6A /* UIScrollView+MJExtension.m */; settings = {COMPILER_FLAGS = "-Wno-unguarded-availability-new"; }; }; 2D9DF47F1F7CE2F90042D6DD /* UIScrollView+MJRefresh.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DB2EA141BECBE6700D58F6A /* UIScrollView+MJRefresh.m */; }; 2D9DF4801F7CE2F90042D6DD /* UIView+MJExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DB2EA161BECBE6700D58F6A /* UIView+MJExtension.m */; }; 2D9DF4811F7CE2F90042D6DD /* NSBundle+MJRefresh.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D4698851D0EE6A400CB8025 /* NSBundle+MJRefresh.m */; };