理由がわかりません。すべてが正常に見えます;(しかし、ブックの@interfaceが表示されず、simplebookmanager.mでセレクター「initWithAuthor」が宣言されています。Xcodeをシャットダウンして再度実行しようとしましたが、機能しませんでした
book.h
#import<Foundation/Foundation.h>
@interface Book : NSObject
@property NSString *author;
@property NSString *titel;
@property NSInteger price;
@property NSString *isbn;
@property NSString *course;
- (id)initWithAuthor:(NSString *)aAuthor
titel:(NSString*)aTitel
price:(NSInteger)aPrice
isbn:(NSString*)anIsbn
course:(NSString*)aCourse;
@終わり
book.m
#import "Book.h"
@implementation Book
-(id)initWithAuthor:(NSString *)aAuthor
titel:(NSString*)aTitel
price:(NSInteger)aPrice
isbn:(NSString*)anIsbn
course:(NSString*)aCourse {
self = [super init];
if (self) {
_author = [aAuthor copy];
_titel = [aTitel copy]; // ???
_price = aPrice;
_isbn = [anIsbn copy];
_course = [aCourse copy];
}
return self;
}
@end
------------------------------------------------------------
#import "SimpleBookManager.h"
#import "BookManagerProtocol.h"
#import "Book.h"
@interface SimpleBookManager()
@property NSMutableArray *allBooks;
@end
SimpleBookManager.m
@implementation SimpleBookManager
-(id)init {
self = [super init];
if (self) {
_allBooks = [[NSMutableArray alloc] init];
Book *b1 = [[Book alloc]initWithAuthor :@"Ben"]; <---- got error in this part
}
return self;
}
@end
---------------------------------------------------------
SimpleBookManager.h
#import <Foundation/Foundation.h>
#import "BookManagerProtocol.h"
#import "Book.h"
@interface SimpleBookManager : NSObject<BookManagerProtocol>
@end