Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reachability prob ios6

Tags:

iphone

ios6

In application Showing Reachability error in ios6.Can any one please help me to sort out this error in reachability ios6,PLease do the needfully.

@implementation Reachability
 static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
 {
#pragma unused (target, flags)
NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCall9back");

//We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively
// in case someon uses the Reachablity object in a different thread.


Reachability* noteObject = (Reachability*) info;
// Post a notification to notify the client that the network reachability changed.
[[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject];


  }

 - (BOOL) startNotifier
 {
BOOL retVal = NO;
SCNetworkReachabilityContext    context = {0, self, NULL, NULL, NULL};
if(SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context))
{
    if(SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode))
    {
        retVal = YES;
    }
}
return retVal;
  }

Error:

 Cast of C pointer type 'void *' to Objective-C pointer type 'NSObject *' requires a bridged cast
like image 669
MohanRaj S Avatar asked Dec 03 '25 22:12

MohanRaj S


1 Answers

id objInfo = (__bridge id)info;
NSCAssert([objInfo isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCall9back");
Reachability* noteObject = (Reachability*) objInfo ;
like image 173
Inder Kumar Rathore Avatar answered Dec 06 '25 17:12

Inder Kumar Rathore



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!