Hi,
A while back I included some code from a sample project that setup Game Center/Kit. This code used a Class called “ Reachability”:
Copyright (c) 2011, Tony Million.
All rights reserved.
From looking at the code it looks quite old and I’m not sure how “right” it is. Is there another version of “Reachability” that I should be using?
When I Compile/Analyse the project, I get warnings on these statements:
+(Reachability*)reachabilityWithHostname:(NSString*)hostname
{
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(NULL, [hostname UTF8String]);
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref]; //**********************Potential Leak
#if __has_feature(objc_arc)
return reachability;
#else
return [reachability autorelease];
#endif
}
+(Reachability *)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress
{
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref]; //**********************Potential Leak
#if __has_feature(objc_arc)
return reachability;
#else
return [reachability autorelease];
#endif
}
return nil;
}