【问题标题】:iphone App crashes while Parsingiphone App在解析时崩溃
【发布时间】:2011-03-01 13:15:01
【问题描述】:

我的应用程序在执行 [NSXMLParser parse] 时崩溃了;声明,和
我正在关注:

2011-03-01 09:36:31.735 MasterApp[228:207] -[NSCFString bytes]:无法识别的选择器发送到实例 0x5f6b000
2011-03-01 09:36:31.738 MasterApp[228:207] * 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[NSCFString 字节]:无法识别的选择器发送到实例 0x5f6b000”
*
首次抛出时调用堆栈:
(
0 CoreFoundation 0x0252eb99 异常预处理 + 185
1 libobjc.A.dylib 0x0267e40e objc_exception_throw + 47
2 CoreFoundation 0x025306ab -[NSObject(NSObject) 不识别选择器:] + 187
3 CoreFoundation 0x024a02b6 __转发
+ 966
4 核心基础 0x0249fe72 _CF_forwarding_prep_0 + 50
5 基础 0x00114afc -[NSXMLParser 解析] + 147
6 MasterApp 0x0000c731 -[identifierList getUrl] + 994
7 MasterApp 0x0000c306 -[identifierList actionSheet:clickedButtonAtIndex:] + 56
8 UIKit 0x0077047d -[UIActionSheet(Private) _buttonClicked:] + 258
9 UIKit 0x002dc7f8 -[UIApplication sendAction:to:from:forEvent:] + 119
10 UIKit 0x00367de0 -[UIControl sendAction:to:forEvent:] + 67
11 UIKit 0x0036a262 -[UIControl(内部)_sendActionsForEvents:withEvent:] + 527
12 UIKit 0x00368e0f -[UIControl touchesEnded:withEvent:] + 458
13 UIKit 0x003003d0 -[UIWindow _sendTouchesForEvent:] + 567
14 UIKit 0x002e1cb4 -[UIApplication sendEvent:] + 447
15 UIKit 0x002e69bf _UIApplicationHandleEvent + 7672
16 图形服务 0x02d8a822 PurpleEventCallback + 1550
17 核心基础 0x0250fff4 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 52
18 核心基础 0x02470807 __CFRunLoopDoSource1 + 215
19 核心基础 0x0246da93 __CFRunLoopRun + 979
20 核心基础 0x0246d350 CFRunLoopRunSpecific + 208
21 核心基础 0x0246d271 CFRunLoopRunInMode + 97
22 图形服务 0x02d8900c GSEventRunModal + 217
23 图形服务 0x02d890d1 GSEventRun + 115
24 UIKit 0x002eaaf2 UIApplicationMain + 1160
25 MasterApp 0x00001dbc 主 + 102
26 MasterApp 0x00001d4d 开始 + 53
)
在抛出“NSException”实例后调用终止
节目接收信号:“SIGABRT”。

提前谢谢你

【问题讨论】:

  • 只是抛出通常的建议:这听起来像是在某处缺少保留。
  • 感谢您的回复,我分析了我的代码但保留不是大小写...仍然混淆问题出在哪里
  • 你能添加你用来解析的代码吗?好像您正在发送一条消息(调用方法),但您发送到的对象无法识别该消息(调用方法)......
  • @MiKL,下面是代码,我也在使用同步 NSURL -- NSError *error; NSURLResponse *响应; NSData *urlData=[NSURLConnection sendSynchronousRequest:req returnedResponse:&response error:&error]; webData =[[NSString alloc]initWithData:urlData 编码:NSUTF8StringEncoding]; if (xmlParser) { [xmlParser 发布]; } xmlParser = [[NSXMLParser alloc] initWithData:webData]; [xmlParser setShouldResolveExternalEntities:YES]; [xmlParser setDelegate: self]; [xmlParser 解析];
  • @MiKL,我只是尝试在 xmlParser = [[NSXMLParser alloc] initWithData:urlData] 中使用“urlData”而不是 webData;现在它解析得很好......

标签: iphone objective-c parsing nsxmlparser nsurl


【解决方案1】:

我只是尝试在 xmlParser = [[NSXMLParser alloc] initWithData:urlData]; 中使用“urlData”而不是 webData现在它解析得很好

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多