实施 tapjoy 分析代码后可达性代码中的应用程序崩溃

Application crash in reachability code after implement the tapjoy analytics code

实施 tapjoy 分析工具后,我的应用程序在下面的可达性代码中崩溃

//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");
    }
} 

当我打印 NSParameterAssert 日志时,它会说如下内容。

*** Assertion failure in -[AppDelegate reachabilityChanged:],

当我打印通知时,它会像这样打印值。

NSConcreteNotification 0x7e070470 {name = >kNetworkReachabilityChangedNotification; object = 0x7a67e070>}

我怎样才能克服这个问题?我想要 tapjoy 和 Reachability。

出现以下错误。

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

能否请您添加此代码并查看 again.It 可能对您有所帮助。

//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");
        }
    }
    
}

快乐编码...