【问题标题】:NSURLConnectionDelegate crashes on runNSURLConnection Delegate 在运行时崩溃
【发布时间】:2011-07-01 14:15:16
【问题描述】:

NSURLConnectionDelegate 确实减少了内存消耗并有助于非常快速地解析数据。我使用了来自 Apple 商店的 SeismicXML 的逻辑,并用于解析数据。但我的新问题是,每当我“构建和调试”我的代码时,它运行良好。但是当我自己运行应用程序时它不起作用。有没有人知道为什么我自己运行它时它不起作用。我尝试使用“构建和分析”我的代码,但它没有显示我的内存管理问题的任何错误。 我确实查看了崩溃的日志,这是我收到的:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000007d89f87d
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
objc_msgSend() selector name: release
iPhone Simulator 235, iPhone OS 4.2 (iPhone/8C134)

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                 0x01134a63 objc_msgSend + 23
1   UIKit                           0x004ab1e2 -[UITableViewCell removeFromSuperview] + 167
2   UIKit                           0x003249d9 -[UIView dealloc] + 340
3   UIKit                           0x0032e281 -[UIScrollView dealloc] + 341
4   UIKit                           0x003661ce -[UITableView dealloc] + 1085
5   CoreFoundation                  0x00ee9a6c CFRelease + 92
6   CoreFoundation                  0x00f0eb8d _CFAutoreleasePoolPop + 237
7   QuartzCore                      0x00d9a71c run_animation_callbacks(double, void*) + 359
8   QuartzCore                      0x00d9a589 CA::timer_callback(__CFRunLoopTimer*, void*) + 157
9   CoreFoundation                  0x00fb3fe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
10  CoreFoundation                  0x00fb5594 __CFRunLoopDoTimer + 1220
11  CoreFoundation                  0x00f11cc9 __CFRunLoopRun + 1817
12  CoreFoundation                  0x00f11240 CFRunLoopRunSpecific + 208
13  CoreFoundation                  0x00f11161 CFRunLoopRunInMode + 97
14  GraphicsServices                0x01874268 GSEventRunModal + 217
15  GraphicsServices                0x0187432d GSEventRun + 115
16  UIKit                           0x002fa42e UIApplicationMain + 1160
17  Tab_Table_Win                   0x00001d7c main + 102 (main.m:14)
18  Tab_Table_Win                   0x00001d0d start + 53

Thread 1:  Dispatch queue: com.apple.libdispatch-manager
0   libSystem.B.dylib               0x94470982 kevent + 10
1   libSystem.B.dylib               0x9447109c _dispatch_mgr_invoke + 215
2   libSystem.B.dylib               0x94470559 _dispatch_queue_invoke + 

【问题讨论】:

  • 实际上,我不确定哪个代码正在破坏以及在哪里显示错误。当我调试它时,它不会显示任何错误,但是当我在 xcode 外部自行运行它时,它会崩溃。

标签: iphone nsurlconnection nsxmlparser


【解决方案1】:

这不是 NSURLConnection 的问题。您过度释放了一些 UI 组件(可能是某些表格或表格单元格)。

【讨论】:

    【解决方案2】:

    很可能是过度释放表格视图的问题。

    你在使用 UITableViewController 吗?如果是这样,你不应该自己释放 tableview(看起来你是这样),否则检查你在哪里分配/释放它,以确保你调用 release 的次数没有超出必要。

    否则,请发布您的视图控制器接口声明,以及您分配/访问表视图的代码(可能是您的 viewDidLoad)和您的 dealloc 方法。

    【讨论】:

      【解决方案3】:
       @Rog
      

      这是我使用 UITableViewController 并释放已分配对象的代码。仅供参考,我正在使用 NSOperationQueue 解析我的 XML 文件并提取数据并解析它。

       @interface TableViewController : UITableViewController 
       {
        IBOutlet UITableView *eTableView;
        NSArray *cellNames;
        NSMutableArray *listArray;
        WinAppDelegate *appDelegate;
      
        }
      
        @property (nonatomic, retain) UITableView *eTableView;
      
        @property (nonatomic, retain) NSArray *cellNames;
      
        @property (nonatomic, retain) NSMutableArray *listArray;
      
        - (void)dealloc 
        {
        [cellNames release];
      [eTableView release];
           [listArray release];
      [super dealloc];
         }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-07-06
        • 1970-01-01
        • 1970-01-01
        • 2018-12-28
        相关资源
        最近更新 更多