我正在開發一個iOS應用程序的iOS 5和Im stucked陣列問題。我有一個自定義的類,我稱之爲人員。人員由兩個數組組成。一個給男孩,一個給女孩。首先,我想用另一個類的方法來填充Persons對象,而且我很確定這是適合的。但是當我要將代碼中的Persons對象分解爲單個數組時,它不起作用。它感覺就像Persons對象,或者它的數組以某種方式被阻塞。請幫忙。此代碼扔我看起來像一個錯誤:2012-07-24 09:29:03.073 PersonApp[4375:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary Boys]: unrecognized selector sent to instance 0x6ac0fe0'
NSInvalidArgumentException當使用NSArray
Persons.h
#import <Foundation/Foundation.h>
@interface Persons : NSObject {
NSArray *Boys;
NSArray *Girls;
}
@property (nonatomic, copy) NSArray *Boys;
@property (nonatomic, copy) NSArray *Girls;
@end
PersonsViewController.h
#import <UIKit/UIKit.h>
#import "Persons.h"
@interface PersonsViewController : UITableViewController
@property (nonatomic, strong) Persons *persons;
@end
PersonsViewController.m
#import "PersonsViewController.h"
NSArray *boys;
NSArray *girls;
...................
@synthesize persons;
...................
Communication *comm = [[Communication alloc] init];
self.persons = [comm getPersons];
boys = [self.persons Boys];
girls = [self.persons Girls];
這似乎是正確的課程。 – parek 2012-07-24 07:41:10