After implementation of the tapjoy analytics tool my application is crash in Reachability code which is below
//Called by Reachability whenever status changes.
- (void) reachabilityChanged: (NSNotification* )note
{
_changeReachability = YES;
Reachability* curReach = [note object];
NSParameterAssert([curReach isKindOfClass: [Reachability class]]);// Application crash here
[self updateInterfaceWithReachability: curReach];
if (!isNetAvailable)
{
NSLog(@"Disconnect");
}
else
{
NSLog(@"Connect");
}
}
when i print the NSParameterAssert log it say something like following.
*** Assertion failure in -[AppDelegate reachabilityChanged:],
and when i print the notification it print value like this.
NSConcreteNotification 0x7e070470 {name = >kNetworkReachabilityChangedNotification; object = 0x7a67e070>}
How can i over come from this problem? i want both thing tapjoy and Reachability.
Following error is coming.
2015-04-27 15:37:18.485 TravAlarm[784:30364] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: [curReach isKindOfClass: [Reachability class]]'
*** First throw call stack:
(
0 CoreFoundation 0x05b14946 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x05799a97 objc_exception_throw + 44
2 CoreFoundation 0x05b147da +[NSException raise:format:arguments:] + 138
3 Foundation 0x02991810 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 118
4 TravAlarm 0x001ef3dc -[AppDelegate reachabilityChanged:] + 348
5 Foundation 0x028cbc49 __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke + 40
6 CoreFoundation 0x05adf4a4 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
7 CoreFoundation 0x059cd03b _CFXNotificationPost + 3051
8 Foundation 0x028bb246 -[NSNotificationCenter postNotificationName:object:userInfo:] + 98
9 Foundation 0x028d801e -[NSNotificationCenter postNotificationName:object:] + 56
10 TravAlarm 0x002e15ce ReachabilityCallback + 462
11 SystemConfiguration 0x04535b32 reachPerform + 559
12 CoreFoundation 0x05a381df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
13 CoreFoundation 0x05a2dced __CFRunLoopDoSources0 + 253
14 CoreFoundation 0x05a2d248 __CFRunLoopRun + 952
15 CoreFoundation 0x05a2cbcb CFRunLoopRunSpecific + 443
16 CoreFoundation 0x05a2c9fb CFRunLoopRunInMode + 123
17 GraphicsServices 0x0617224f GSEventRunModal + 192
18 GraphicsServices 0x0617208c GSEventRun + 104
19 UIKit 0x045d08b6 UIApplicationMain + 1526
20 TravAlarm 0x000d35ed main + 141
21 libdyld.dylib 0x063b7ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Can you please add this code and check again.It's may help you.
//Called by Reachability whenever status changes.
- (void) reachabilityChanged: (NSNotification* )note
{
_changeReachability = YES;
Reachability* curReach = [note object];
if ([curReach isKindOfClass:[Reachability class]])
{
NSParameterAssert([curReach isKindOfClass: [Reachability class]]);
[self updateInterfaceWithReachability: curReach];
if (!isNetAvailable)
{
NSLog(@"Disconnect");
}
else
{
NSLog(@"Connect");
}
}
}
Happy Coding...