0
私はThis Tutorialから作業しており、自己構築型APIを使用してアプリケーションにXMLリーダーを構築しようとしています。私は、XMLを読んで、このエラーを取得維持しようとしています:データの処理に干渉するAutoRelease
*** -[CFString release]: message sent to deallocated instance 0x68675a0
私は解放するか、何を割り当て解除、私は自動解放はそのすべてを処理せてるではありませんよ。ここではメソッドのための私の呼び出しは次のとおりです。
self.dtContact = [DTContactParser loadDTC];
if (_dtContact != nil) {
for (DTContact *dtc in _dtContact.contacts) {
NSLog(@"%@", dtc.description);
}
}
NSLog(@"done");
それはNSLog(@"done");
を送信するとき、私は、このの終わりに私のエラーを取得し、それはエラーがスローされます。ここで
DTContactParserのloadDTC
+ (DTCXMLResponse *)loadDTC {
NSString *filePath = [self dataFilePath:FALSE];
NSData *xmlData = [[NSMutableData alloc] initWithContentsOfFile:filePath];
NSError *error;
GDataXMLDocument *doc = [[GDataXMLDocument alloc] initWithData:xmlData
options:0 error:&error];
if (doc == nil) { return nil; }
DTCXMLResponse *dtcxmlr = [[DTCXMLResponse alloc] init];
NSArray *dtcontacts = [doc.rootElement elementsForName:@"DetectiveContact"];
for (GDataXMLElement *dtcontact in dtcontacts) {
// Let's fill these in!
NSString *description;
int dtcid;
// Name
NSArray *descriptions = [dtcontact elementsForName:@"description"];
if (descriptions.count > 0) {
GDataXMLElement *firstName = (GDataXMLElement *) [descriptions objectAtIndex:0];
description = firstName.stringValue;
} else continue;
// Level
NSArray *ids = [dtcontact elementsForName:@"idDetectiveContact"];
if (ids.count > 0) {
GDataXMLElement *firstID = (GDataXMLElement *) [ids objectAtIndex:0];
dtcid = firstID.stringValue.intValue;
} else continue;
DTContact *dtcontact = [[DTContact alloc] initWithName:description dtId:dtcid];
[dtcxmlr.contacts addObject:dtcontact];
return nil;
}}
であり、ここでDTContactです:
#import "DTContact.h"
@implementation DTContact
@synthesize description = _description;
@synthesize dtId = _dtId;
- (id)initWithName:(NSString *)description dtId:(int)dtId{
if ((self = [super init])) {
self.description = description;
self.dtId = dtId;
}
return self;
}
@end
任意の助けもいただければ幸いです。
はARC対応ですか? –
はい、有効にしました。 –