mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-26 04:57:54 +00:00
Use SCNetworkReachabilityCreateWithName rather than SCNetworkCheckReachabilityByName, which is deprecated.
This commit is contained in:
1 parent
e71915b4fb
commit
9cc1905f87
1 file changed
+8
-2
+8
-2
@@ -17,7 +17,7 @@
|
||||
#import "SUScheduledUpdateDriver.h"
|
||||
#import "SUConstants.h"
|
||||
#import "SULog.h"
|
||||
#include <SystemConfiguration/SCNetwork.h> // UK 2007-04-27
|
||||
#include <SystemConfiguration/SystemConfiguration.h>
|
||||
|
||||
|
||||
@interface SUUpdater (Private)
|
||||
@@ -232,7 +232,13 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
// Don't perform automatic checks on unconnected laptops or dial-up connections that aren't online:
|
||||
NSMutableDictionary* theDict = [NSMutableDictionary dictionary];
|
||||
[self performSelectorOnMainThread: @selector(putFeedURLIntoDictionary:) withObject: theDict waitUntilDone: YES]; // Get feed URL on main thread, it's not safe to call elsewhere.
|
||||
if( SCNetworkCheckReachabilityByName( [[[theDict objectForKey: @"feedURL"] host] cStringUsingEncoding: NSUTF8StringEncoding], &flags ) )
|
||||
|
||||
const char *hostname = [[[theDict objectForKey: @"feedURL"] host] cStringUsingEncoding: NSUTF8StringEncoding];
|
||||
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, hostname);
|
||||
Boolean reachabilityResult = SCNetworkReachabilityGetFlags(reachability, &flags);
|
||||
CFRelease(reachability);
|
||||
|
||||
if( reachabilityResult )
|
||||
{
|
||||
BOOL reachable = (flags & kSCNetworkFlagsReachable) == kSCNetworkFlagsReachable;
|
||||
BOOL automatic = (flags & kSCNetworkFlagsConnectionAutomatic) == kSCNetworkFlagsConnectionAutomatic;
|
||||
|
||||
Reference in new issue
Block a user