1
그래, 내가 xcode를 처음 사용하기는했지만이 문제와 관련된 특정 항목을 찾을 수 없다. 그래서 나는 배열을 선언하고 다음 파일에서 인스턴스화 : 나는 혼란 스러워요 곳NSMutableArray 개체 추가/제거 (상속 된 파일)
//xmlToUrl.h
#import <Foundation/Foundation.h>
@interface xmlToUrl : NSObject {
NSMutableArray *field;
NSMutableArray *name;
}
@property(nonatomic, retain)NSMutableArray *field;
@property(nonatomic, retain)NSMutableArray *name;
@end
및
//xmlToUrl.m
#import "xmlToUrl.h"
@implementation xmlToUrl
@synthesize field;
@synthesize name;
-(void)dealloc
{
[field release];
[name release];
[super dealloc];
}
@end
그래서이있다. 나는 정확하게 "alloc"또는 "init"하는 방법을 모르거나, xmlToUrl.h를 상속받은 다른 파일에서 추가/제거 작업을 처리하는 방법을 모른다.
다른 파일에있는 코드는 이제 null로 인쇄됩니다. 그 아래 나열된. 내가 도대체 뭘 잘못하고있는 겁니까?!?
//nodeContent is just a NSMutableString
[xmlToUrlObject.name addObject:nodeContent];
NSLog(@"xml Name = %@", xmlToUrlObject.name);
//I omitted all the operational code here but if I NSLog nodeContent it prints the correct values
[xmlToUrlObject.field addObject:nodeContent];
NSLog(@"xml Field = %@", xmlToUrlObject.field);
완벽하게 작동했습니다. 고맙습니다!! : D 나는 +1 할 담당자가 충분하지 않지만 누군가이 댓글을 읽는다면 그것을받을 가치가있다! – MrHappyAsthma