代码之家  ›  专栏  ›  技术社区  ›  nicktmro

应用程序在nsurlconnection中崩溃

  •  3
  • nicktmro  · 技术社区  · 14 年前

    我想知道是什么导致了这次车祸。我已经构建了这个应用程序并将其提供给了我们的测试人员,但是我们似乎无法可靠地复制它。有时候会发生…

    Thread 0 Crashed:
    0   libobjc.A.dylib                0x000027da objc_msgSend + 18
    1   Foundation                     0x00032896 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 62
    2   Foundation                     0x00032818 _NSURLConnectionDidFinishLoading + 72
    3   CFNetwork                      0x00010dd8 URLConnectionClient::_clientDidFinishLoading(URLConnectionClient::ClientConnectionEventQueue*) + 160
    4   CFNetwork                      0x00004ad4 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 96
    5   CFNetwork                      0x000049c4 URLConnectionClient::processEvents() + 64
    6   CFNetwork                      0x00004976 URLConnection::multiplexerClientPerform(RunLoopMultiplexer*) + 30
    7   CFNetwork                      0x000048f4 MultiplexerSource::perform() + 120
    8   CFNetwork                      0x00004872 MultiplexerSource::_perform(void*) + 2
    9   CoreFoundation                 0x00055f1e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
    10  CoreFoundation                 0x00027ba0 __CFRunLoopDoSources0 + 376
    11  CoreFoundation                 0x00027444 __CFRunLoopRun + 224
    12  CoreFoundation                 0x00027270 CFRunLoopRunSpecific + 224
    13  CoreFoundation                 0x00027178 CFRunLoopRunInMode + 52
    14  GraphicsServices               0x000045ec GSEventRunModal + 108
    15  GraphicsServices               0x00004698 GSEventRun + 56
    16  UIKit                          0x0000411c -[UIApplication _run] + 396
    17  UIKit                          0x00002128 UIApplicationMain + 664
    18  myapp                          0x000020d8 main (main.m:14)
    19  myapp                          0x0000208c start + 32
    

    任何建议都将不胜感激。该应用程序是使用sdk 4.1在xcode 3.2.4中构建的。

    干杯。。。

    2 回复  |  直到 14 年前
        1
  •  1
  •   Andrew    14 年前

    本有一些合理的建议。将nszombieEnabled打开。

    我几乎可以百分之百地肯定地告诉您,它正在崩溃,因为当代理试图向它发送消息时,您有一个nil对象。

    事实上,它只是偶尔崩溃,告诉我,你可能正在使用自动释放。autorelease不会同时递减retain计数,因此有时当对象收到委托消息并且应用程序工作时,它仍将是活动的。但是,有时该对象会被释放,应用程序会崩溃。

        2
  •  2
  •   Ben Gottlieb    14 年前

    我会试着打开nszombienabled,看看这是否对这个问题有所启发。连接的委托是否仍然有效?