雖然返回到我的應用程序從通訊錄中獲取電話號碼,如果我錯誤地獲取一些地址或除電話號碼以外的任何東西,try catch catch中的代碼給出以下但不抓住它,任何想法表示讚賞提前:嘗試捕捉最後不捕捉異常
*** -[CFDictionary length]: message sent to deallocated instance 0x6a4db70
代碼:
strContact = (NSString *)phone; CFRelease(phone);
// NSLog(@"%@", strContact);
CFRelease(multi);
name = (NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
NSRegularExpression *regex = [[[NSRegularExpression alloc] initWithPattern:@"[a-zA-Z]" options:0 error:NULL] autorelease];
// Assuming you have some NSString myString.
NSUInteger matches = [regex numberOfMatchesInString:strContact options:0 range:NSMakeRange(0, [strContact length])];
請在問題 – PresleyDias 2012-01-05 04:39:05
中放一些**代碼**不要犯這麼多錯誤。 – 2012-01-05 04:41:57
另一個catch塊是否會首先捕獲它,也許? – user1118321 2012-01-05 04:43:57