本文介绍了iOS5,StoryBoards,ARC:奇怪的类别问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我用sql方法创建了一个文件,现在这个文件真的很大。我想分裂它的最佳实践和实现简单。所以,类别。 我在xCode新目标c类别文件中创建了 - > DBAccess + Generals.h(.m)。 .h: #importDBAccess.h @interface DBAccess通用) - (void)newMeth; @end .m #importDBAccess + Generals.h #importDBAccess.h @implementation DBAccess b $ b - (void)newMeth { NSLog(@New Meth); } @end 在DBAccess.h #import< Foundation / Foundation.h> #import< sqlite3.h> #importDBAccess + Generals.h @interface DBAccess:NSObject { NSString * databaseName; } @property(nonatomic,strong)NSString * databaseName; DBAccess.m #importDBAccess.h #importDBAccess + Generals.h @implementation DBAccess @synthesize databaseName; sqlite3 * database = nil; - (id)init { if((self = [super init])) { // [self initializeDataBase] databaseName = @world_coins.db; //firstVerDB=@\"ac_ch_ver.1.0.db; } return self; } //方法的方法 @end 看起来代码是OK的。获取错误找不到DBAccess的接口实现。我已经谷歌和堆栈溢出,但所描述的问题,不是我的情况。 任何帮助?提前感谢。解决方案问题是循环导入 #importDBAccess + Generals.h在 DBAccess.h b 如果你删除第一个,代码编译。 I've created a file with sql methods and now this file is really large. I'd like to split it for best practice and implementation simplicity. So, categories. I've created in xCode new objective-c categories file -> DBAccess+Generals.h (.m)..h:#import "DBAccess.h"@interface DBAccess (Generals)-(void)newMeth;@end.m#import "DBAccess+Generals.h"#import "DBAccess.h"@implementation DBAccess (Generals)-(void)newMeth{ NSLog(@"New Meth");}@endIn DBAccess.h#import <Foundation/Foundation.h>#import <sqlite3.h>#import "DBAccess+Generals.h"@interface DBAccess : NSObject{ NSString *databaseName;}@property(nonatomic,strong)NSString *databaseName;DBAccess.m#import "DBAccess.h"#import "DBAccess+Generals.h"@implementation DBAccess@synthesize databaseName;sqlite3* database=nil;-(id)init{ if ((self=[super init])) { //[self initializeDataBase]; databaseName=@"world_coins.db"; //firstVerDB=@"ac_ch_ver.1.0.db"; } return self;}//Tones of methods@endLooks like the code is OK. Getting error "interface implementation not found for DBAccess". I've googled and stackoverflowed around, but the issues described, are not my case.any help? Thank you in advance. 解决方案 The problem is the cyclic import#import "DBAccess+Generals.h" in DBAccess.h#import "DBAccess.h" in DBAccess+Generals.h If you remove the first one, the code compiles. 这篇关于iOS5,StoryBoards,ARC:奇怪的类别问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-24 18:15