0
當我建立我的項目,我有這樣的警告:iOS的類別,子類和覆蓋
ld: warning: instance method 'shareMessage' in category from /Users/attiliopatania/Library/Developer/Xcode/DerivedData/.../Objects-normal/armv7/Place+Factory.o conflicts with same method from another category
我無法明白的地方是結構向各位報告的問題,也許我做使用類別時出錯 當我強制自己使用@class聲明的模式對.h文件和#import的有用標題類與.m 希望有人可以幫助我:)
shareMessage是在類Bean.h中聲明的方法,它是以這種方式爲母地點+廠:
廣場+ Factory.h
#import "Place.h"
@interface Place (Factory)
...
@end
廣場+ Factory.m
#import "Place+Factory.h"
#import "User+Factory.h"
@implementation Place (Factory)
...
- (NSString*) shareMessage{
return @"myMessage"
}
...
@end
注:用戶+工廠有PlaceFactory和它的結構相同也是Bean的孩子。最後我解決 :
Place.h
#import "Bean.h"
@interface Place : Bean
...
@end
Bean.h
#import <Foundation/Foundation.h>
#import "HttpFunction.h"
#import "Usefull.h"
#import "AppManager.h"
@interface Bean : NSObject
...
- (NSString*) shareMessage;
@end
Bean.m
#import "Bean.h"
@implementation Bean
...
- (NSString*) shareMessage{
return [self.class description];
}
...
@end
更新。我在.m文件中查看我所有的類,處理.h文件中的possibile @ class和#導入順序(這似乎是真正的問題)。
您的意思是@實現地點(工廠) - > @實現在Place + Factory.h中的Bean? – tylyo