Skip to content

Commit

Permalink
Remove conflicting nullable specifier on init
Browse files Browse the repository at this point in the history
The nullable specifier on init conflicts with the nonnull specifier on NSObject which generates a warning. This change removes it and throws an exception if init is used.
  • Loading branch information
nrbrook authored and SlaunchaMan committed Mar 16, 2018
1 parent 7bc866d commit 2315d76
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 2 additions & 4 deletions AFNetworking/AFNetworkReachabilityManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,9 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER;

/**
* Initializes an instance of a network reachability manager
*
* @return nil as this method is unavailable
* Unavailable initialiser
*/
- (nullable instancetype)init NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;

///--------------------------------------------------
/// @name Starting & Stopping Reachability Monitoring
Expand Down
3 changes: 2 additions & 1 deletion AFNetworking/AFNetworkReachabilityManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,9 @@ - (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability {
return self;
}

- (instancetype)init NS_UNAVAILABLE
- (instancetype)init
{
@throw [NSException exceptionWithName:NSGenericException reason:@"`-init` unavailable. Use `-initWithReachability:` instead" userInfo:nil];
return nil;
}

Expand Down

0 comments on commit 2315d76

Please sign in to comment.