好的,这确实困扰着我,我相信解决方案很简单......我无法从另一个类 (SeverConnect.m) 设置我的 ViewController 的属性变量,我已经在我的 ViewController 的 .h/ 中正确声明和合成了它。 m 文件:
服务器连接.h:
#import <Foundation/Foundation.h>
#import "ViewController.h"
#import "Contact.h"
@class ViewController;
@interface ServerConnect : NSObject
{
Contact *newContact;
NSString *codeRawContent;
NSMutableArray *contactListCopy;
... //Other variables declared here, but not shown in order to save space
ServerConnect.m 内部:
- (void)parserDidEndDocument:(NSXMLParser *)parser
{
NSLog(@"parserDidFinish");
newContact = [[Contact alloc] initWithCodeInfo:(NSString *)codeInfo
contactName:(NSString *)completeName
contactImage:(UIImage *)profileImage
contactWebSite:(NSString *)codeRawContent];
[contactListCopy insertObject:newContact atIndex:0];
[ViewController setContactList:contactListCopy]; //Automatic Reference Counting Error Occurs Here: "No known class method for selector 'setContactList:'"
}
如上所述,我在 ViewController 的 .h/.m 文件中声明并合成了属性变量“contactList”(没有错误):
@property (nonatomic, retain) NSMutableArray *contactList; //In ViewController's .h file
@synthesize contactList; //In ViewController's .m file
有人可以告诉我我做错了什么吗?提前感谢您提供的任何帮助!