我的iOS应用程序从webservice xml获取数据并在我的项目中解析。使用iPad(Real Device)进行调试时,一切正常,但在临时应用程序崩溃时发布。我收到了以下崩溃报告。
Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by Thread: 0 Filtered syslog: None found Last Exception Backtrace: 0 CoreFoundation 0x22d28676 __exceptionPreprocess + 122 1 libobjc.A.dylib 0x348d6e12 objc_exception_throw + 34 2 CoreFoundation 0x22d2de90 -[NSObject(NSObject) doesNotRecognizeSelector:] + 184 3 CoreFoundation 0x22d2bac4 ___forwarding___ + 696 4 CoreFoundation 0x22c5c124 _CF_forwarding_prep_0 + 20 5 AGD 0x0010de0c -[QRConfirmViewController CuttingDynamicKeyNode:] (QRConfirmViewController.m:583) 6 Foundation 0x23b06bb8 _endElementNs + 592 7 libxml2.2.dylib 0x34eae2b2 xmlParseEndTag2 + 686 8 libxml2.2.dylib 0x34eab58a xmlParseTryOrFinish + 2014 9 libxml2.2.dylib 0x34eaa764 xmlParseChunk + 576 10 Foundation 0x23b042bc -[NSXMLParser parseData:] + 292 11 Foundation 0x23b04504 -[NSXMLParser parseData:] + 876 12 Foundation 0x23b0468a -[NSXMLParser parseFromStream] + 282 13 AGD 0x0010db22 -[QRConfirmViewController connectionDidFinishLoading:] (QRConfirmViewController.m:516) 14 CFNetwork 0x22687d58 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 52 15 CFNetwork 0x22687d10 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 180 16 CFNetwork 0x22687e04 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 32 17 CFNetwork 0x22547c1a ___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 74 18 CFNetwork 0x226018ba ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 66 19 libdispatch.dylib 0x34ffbbd2 _dispatch_client_callout + 18 20 libdispatch.dylib 0x35005182 _dispatch_block_invoke$VARIANT$mp + 442 21 CFNetwork 0x22538caa RunloopBlockContext::_invoke_block(void const*, void*) + 14 22 CoreFoundation 0x22c3cb4c CFArrayApplyFunction + 32 23 CFNetwork 0x22538b92 RunloopBlockContext::perform() + 178 24 CFNetwork 0x22538a5c MultiplexerSource::perform() + 212 25 CFNetwork 0x225388f4 MultiplexerSource::_perform(void*) + 44 26 CoreFoundation 0x22cebbfa __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 10 27 CoreFoundation 0x22ceb7e8 __CFRunLoopDoSources0 + 448 28 CoreFoundation 0x22ce9b56 __CFRunLoopRun + 790 29 CoreFoundation 0x22c3d114 CFRunLoopRunSpecific + 516 30 CoreFoundation 0x22c3cf00 CFRunLoopRunInMode + 104 31 GraphicsServices 0x2bddaac4 GSEventRunModal + 156 32 UIKit 0x26e7ff10 UIApplicationMain + 140 33 AGD 0x0006d57a main (main.m:16) 34 libdyld.dylib 0x3504586e tlv_get_addr + 42
但是我的方法中找不到任何错误。我的方法如下:
-CuttingDynamicKeyNode:(NSString *)nodes{
NSString * result = [NSString stringWithFormat:@"%@",nodes];
NSString * _key = AES_KEYS;
StringEncryption *crypto = [[[StringEncryption alloc] init] autorelease];
CCOptions padding = kCCOptionPKCS7Padding;
//Decrypt method
NSData * data = [[NSData alloc]initWithBase64EncodedString:result];
NSData * decrypteStringData = [crypto decrypt:data key:[_key dataUsingEncoding:NSUTF8StringEncoding] padding:&padding];
NSString * stringNodesResult = [[NSString alloc] initWithData:decrypteStringData encoding:NSUTF8StringEncoding];
/// Get Nodes Elements........
AppDelegate * delegate = [[UIApplication sharedApplication]delegate];
//ObjectSVNotification * objNoti = [[ObjectSVNotification alloc]init];
GDataXMLDocument * doc = [[GDataXMLDocument alloc]init];
[doc initWithXMLString:stringNodesResult encoding:NSUTF8StringEncoding error:NULL];
if (doc == nil) {
NSLog(@"Doc is NuLL :::: ");
}
if (doc) {
// For Store in Notification Table ......
NSArray *arrayField43 = [doc nodesForXPath:@"//Node/Field43" error:NULL];
NSArray *arrayField44= [doc nodesForXPath:@"//Node/Field44" error:NULL];
NSArray * arrayField118 = [doc nodesForXPath:@"//Node/Field118" error:NULL];
NSArray * arrayField117 = [doc nodesForXPath:@"//Node/Field117" error:NULL];
NSArray * arrayField119 = [doc nodesForXPath:@"//Node/Field119" error:NULL];
NSArray * arrayField67 = [doc nodesForXPath:@"//Node/Field67" error:NULL];
NSMutableArray * arrayFieldF43 = [[NSMutableArray alloc]init];
NSMutableArray * arrayFieldF44 = [[NSMutableArray alloc]init];
NSMutableArray * arrayFieldF118 = [[NSMutableArray alloc]init];
NSMutableArray * arrayFieldF119 = [[NSMutableArray alloc]init];
NSMutableArray * arrayFieldF117 = [[NSMutableArray alloc]init];
NSMutableArray * arrayFieldF67 = [[NSMutableArray alloc]init];
NSString * Key1 = [[NSString alloc]init];
NSString * Key2 = [[NSString alloc]init];
NSString * OneTime = [[NSString alloc]init];
NSString * DeviceID = [[NSString alloc]init];
NSString *ResponseCode = [[NSString alloc]init];
NSString *ResponseDescription = [[NSString alloc]init];
for (GDataXMLElement *eleField43 in arrayField43) {
//Decrypt method
NSString *tempKey1 = [eleField43 stringValue];
NSData * data1 = [[NSData alloc]initWithBase64EncodedString:tempKey1];
NSData * dataKey1 = [crypto decrypt:data1 key:[_key dataUsingEncoding:NSUTF8StringEncoding] padding:&padding];
NSString * resultKey1 = [[NSString alloc] initWithData:dataKey1 encoding:NSUTF8StringEncoding];
ResponseCode = resultKey1;
[arrayFieldF43 addObject:ResponseCode];
}
for (GDataXMLElement *eleField44 in arrayField44) {
//Decrypt method
NSString *tempKey1 = [eleField44 stringValue];
NSData * data1 = [[NSData alloc]initWithBase64EncodedString:tempKey1];
NSData * dataKey1 = [crypto decrypt:data1 key:[_key dataUsingEncoding:NSUTF8StringEncoding] padding:&padding];
NSString * resultKey1 = [[NSString alloc] initWithData:dataKey1 encoding:NSUTF8StringEncoding];
ResponseDescription = resultKey1;
[arrayFieldF44 addObject:ResponseDescription];
}
for (GDataXMLElement *eleField118 in arrayField118) {
//Decrypt method
NSString *tempKey1 = [eleField118 stringValue];
NSData * data1 = [[NSData alloc]initWithBase64EncodedString:tempKey1];
NSData * dataKey1 = [crypto decrypt:data1 key:[_key dataUsingEncoding:NSUTF8StringEncoding] padding:&padding];
NSString * resultKey1 = [[NSString alloc] initWithData:dataKey1 encoding:NSUTF8StringEncoding];
Key2 = resultKey1;
[arrayFieldF118 addObject:Key2];
}
for (GDataXMLElement *eleField117 in arrayField117) {
//Decrypt method
NSString *tempKey3 = [eleField117 stringValue];
NSData * data3 = [[NSData alloc]initWithBase64EncodedString:tempKey3];
NSData * dataKey3= [crypto decrypt:data3 key:[_key dataUsingEncoding:NSUTF8StringEncoding] padding:&padding];
NSString * resultKey3= [[NSString alloc] initWithData:dataKey3 encoding:NSUTF8StringEncoding];
Key1 = resultKey3;
[arrayFieldF117 addObject:Key1];
}
for (GDataXMLElement *eleField119 in arrayField119) {
//Decrypt method
NSString *tempKeyOneTime = [eleField119 stringValue];
NSData * dataOneTime = [[NSData alloc]initWithBase64EncodedString:tempKeyOneTime];
NSData * dataKeyOneTime= [crypto decrypt:dataOneTime key:[_key dataUsingEncoding:NSUTF8StringEncoding] padding:&padding];
NSString * resultKey2 = [[NSString alloc] initWithData:dataKeyOneTime encoding:NSUTF8StringEncoding];
OneTime = resultKey2;
[arrayFieldF119 addObject:OneTime];
// NSLog(@"One Time Password ::::::::: %@",OneTime);
}
for (GDataXMLElement *eleField67 in arrayField67) {
//Decrypt method
NSString *tempKeyDID = [eleField67 stringValue];
NSData * dataDID = [[NSData alloc]initWithBase64EncodedString:tempKeyDID];
NSData * dataKeyDID= [crypto decrypt:dataDID key:[_key dataUsingEncoding:NSUTF8StringEncoding] padding:&padding];
NSString * resultKeyDID = [[NSString alloc] initWithData:dataKeyDID encoding:NSUTF8StringEncoding];
DeviceID = resultKeyDID;
[arrayFieldF67 addObject:DeviceID];
}
ObjectDynamic * dynamic=[[ObjectDynamic alloc]init];
NSLog(@"Responese Description in QRConfirm %@",ResponseDescription);
[activityView stopAnimating];
activityView.hidden = TRUE;
imgVLoading.hidden = TRUE;
if ([ResponseDescription isEqualToString:@"Success"])
{
AppDelegate * delegate = [[UIApplication sharedApplication]delegate];
dynamic.Key_1=Key1;
dynamic.key_2=Key2;
[delegate.db updatetKey:dynamic];
[delegate showLoginByVID:QRRESULT];
}
else
{
//Do Something
}
[nodeContent release];
[doc release];
}
}