iOS崩溃日志NSObject didNotRecognizeSelector:-在哪一行? [英] iOS Crash Log NSObject doesNotRecognizeSelector: - at which line?

查看:326
本文介绍了iOS崩溃日志NSObject didNotRecognizeSelector:-在哪一行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我记录了我的应用程序崩溃,但是我的应用程序(5 Control)的最后一行仅指向方法begin。我怎么知道问题出在哪一行?

I have recorded a crash of my app, but the last line in my app (5 Control) points just to the method begin. How do I know in which line the problem is?

0   CoreFoundation                  0x185f0af50 __exceptionPreprocess + 132
1   libobjc.A.dylib                 0x1924141fc objc_exception_throw + 60
2   CoreFoundation                  0x185f0fc04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 220
3   CoreFoundation                  0x185f0d930 ___forwarding___ + 912
4   CoreFoundation                  0x185e2d5dc _CF_forwarding_prep_0 + 92
5   Control                         0x10005acb4 -[PaymillPaymentService handleTransactionListRequest:] (PaymillPaymentService.m:211)
6   Foundation                      0x186a7416c __103+[__NSOperationInternal _observeValueForKeyPath:ofObject:changeKind:oldValue:newValue:indexes:context:]_block_invoke96 + 28
7   libdispatch.dylib               0x1929ec014 _dispatch_call_block_and_release + 24
8   libdispatch.dylib               0x1929ebfd4 _dispatch_client_callout + 16
9   libdispatch.dylib               0x1929f32b8 _dispatch_root_queue_drain + 556
10  libdispatch.dylib               0x1929f34fc _dispatch_worker_thread2 + 76
11  libsystem_pthread.dylib         0x192b816bc _pthread_wqthread + 356
12  libsystem_pthread.dylib         0x192b8154c start_wqthread + 4

这里是[冗长的]方法代码。我看到可以在其中添加支票的几个地方,但是如何确定才能解决此问题呢?问题是偶发性的,我无法轻易重现。

Here the [lengthy] method code. I see a couple of places where I can add the check but how to I know it for sure that I fixed the issue? The problem is sporadical and I cannot reproduce it easily.

- (void)handleTransactionListRequest:(ServiceRequest *)serviceRequest
{
    LRURLRequestOperation* operation = serviceRequest.operation;
    NSHTTPURLResponse *response = (NSHTTPURLResponse *)operation.URLResponse;

    if (response.statusCode == 200)
    {
        if (operation.responseData)
        {
            NSError *parserError = nil;
            NSDictionary *data = [NSJSONSerialization JSONObjectWithData:operation.responseData options:0 error:&parserError];


            //NSLog(@"%@", data);
            if (!parserError)
            {
                NSArray* transactions = [data objectForKey:@"data"];

                if (0 == serviceRequest.currentOffset)
                {
                    NSNumber* totalCountObj =  [data objectForKey:@"data_count"];
                    serviceRequest.totalCount = [totalCountObj intValue];
                }

                int loadedCount = 0;
                if (transactions)
                {
                    for (id object in transactions)
                    {
                        TransactionInfo* info  = [self createTransactionFrom:object];
                        [serviceRequest.transactionList addTransaction:info];
                        [info release];
                        loadedCount++;
                    }

                }

                if (loadedCount + serviceRequest.currentOffset >= serviceRequest.totalCount)
                {
                    if ([serviceRequest.delegate respondsToSelector:@selector(transactionListLoadingComplete:)])
                        [serviceRequest.delegate transactionListLoadingComplete:serviceRequest];

                    serviceRequest.transactionList.timeStamp = [[NSDate date] timeIntervalSince1970];
                    NSLog(@"COMPLETE: %d transaction loaded ", serviceRequest.totalCount);
                }
                else
                {
                    serviceRequest.currentOffset += loadedCount;

                    bool needToContinue = YES;

                    if ([serviceRequest.delegate respondsToSelector:@selector(transactionListLoadingContinue:)])
                        needToContinue = [serviceRequest.delegate transactionListLoadingContinue];

                    if (needToContinue)
                    {
                        [self continueRetrievingTransactionListFor:serviceRequest];
                        NSLog(@"CONTINUE: %d of %d loaded ", serviceRequest.currentOffset, serviceRequest.totalCount);
                    }

                }

                return; // all OK cases
            }
        }

    }

    if ([serviceRequest.delegate respondsToSelector:@selector(transactionListLoadingFailed:with:)])
        [serviceRequest.delegate transactionListLoadingFailed:serviceRequest with:response.statusCode];
    NSLog(@"ERROR: Loading Transactions Response Code: %ld", (long)response.statusCode);

}


推荐答案

简短答案:

您正在向无法有效响应的对象发送消息。堆栈跟踪记录告诉您,在调用 [PaymillPaymentService handleTransactionListRequest:] 时,PaymillPaymentService无法接受handleTransactionListRequest。

You are sending a message to an object that cannot validly respond to it. The stack trace is telling you that when you make the call [PaymillPaymentService handleTransactionListRequest:] that PaymillPaymentService cannot accept handleTransactionListRequest.

长答案:

在此处查看堆栈跟踪:


5控制0x10005acb4-[PaymillPaymentService handleTransactionListRequest:](PaymillPaymentService.m:211)

5 Control 0x10005acb4 -[PaymillPaymentService handleTransactionListRequest:] (PaymillPaymentService.m:211)

这是告诉您在文件PaymillPaymentService.m中在线211您正在向 PaymillPaymentService 发送消息 handleTransactionListRequest ,它无法有效响应。在与rmaddy,Hot Licks和Paulc11的讨论中,您提到第211行是handleTransactionListRequest的函数条目(无论位于哪个文件中)。如果是这样,那是偶然的。

This is telling you that in the file PaymillPaymentService.m on line 211 you are sending PaymillPaymentService the message handleTransactionListRequest to which it cannot validly respond. In your discussion with rmaddy, Hot Licks, and Paulc11 you mentioned that line 211 is the function entry for handleTransactionListRequest (in whatever file it resides). If that's the case it is coincidental.

如果要进一步跟进,则需要发布PaymillPaymentService.m并确保包含所有行号。

If you want further follow up you need to post PaymillPaymentService.m and ensure that you include all the line numbers.

这篇关于iOS崩溃日志NSObject didNotRecognizeSelector:-在哪一行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆