嘿.我一直在研究Twitter应用程序,并且已经在EXC_ BAD_ ACCESS错误上停留了很长时间.我知道EXC_ BAD_ ACCESS是一个内存问题,但我无法确定问题所在.这是我的代码示例:
- (void)viewDidLoad {
[super viewDidLoad];
NSString *path = @"/Volumes/Schools/BHS/Student/740827/Documents/Forrest McIntyre CS193P/Presence2";
NSArray *propList = [NSArray arrayWithContentsOfFile:[NSBundle pathForResource:@"TwitterUsers" ofType:@"plist" inDirectory:path]];
people = [[NSMutableArray alloc]init];
for (NSString *name in propList) {
Person *p = [[Person alloc] initWithUserName: name];
[people addObject: p];
[p release];
}
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
Run Code Online (Sandbox Code Playgroud)
注释后的最后一个大括号抛出异常.我相信它确实被扔进了某个地方的for循环中,但只是出现了.
这是Person的实现文件:
@implementation Person
@synthesize image;
@synthesize username;
@synthesize displayName; …Run Code Online (Sandbox Code Playgroud)