objective-c – Xcode中的未知类型名称(即使使用@class声明)

objective-c – Xcode中的未知类型名称(即使使用@class声明),第1张

概述我在设置数据控制器的简单应用程序时遇到问题.我在@property(强,非原子)BirdsListDataController * dataController行上遇到错误;在BirdsListViewController.h中.我尽力使用BirdsListDataController的@class声明,并尝试从.h文件中删除任何#import语句,并尝试删除一个循环#import,你可以在Bir 我在设置数据控制器的简单应用程序时遇到问题.我在@property(强,非原子)BirdsListDataController * dataController行上遇到错误;在BirdsListVIEwController.h中.我尽力使用BirdsListDataController的@class声明,并尝试从.h文件中删除任何#import语句,并尝试删除一个循环#import,你可以在BirdsListVIEwController的顶部找到它. H.我猜它很简单.

BirdsListVIEwController.h

#import <UIKit/UIKit.h>@class BirdsListDataController;@interface BirdsListVIEwController : UItableVIEwController <UITextFIEldDelegate>{// NSMutableArray *listofBirds;IBOutlet UITextFIEld *addNewBirdTextFIEld;}//@property (nonatomic,retain) NSIndexPath *checkedindexPath;@property (nonatomic,retain) Nsstring *textLabelContents;@property (nonatomic,retain) NSMutableArray *workingArray;@property (strong,nonatomic) BirdsListDataController *dataController;@property (strong,nonatomic) IBOutlet UItableVIEw *birdListtableVIEw;@end

BirdsListVIEwController.m

#import "BirdsListVIEwController.h"#import "BirdsListDataController.h"@interface BirdsListVIEwController ()@end@implementation BirdsListVIEwController- (ID)initWithStyle:(UItableVIEwStyle)style{    self = [super initWithStyle:style];    if (self) {...

BirdsListDataController.h

#import <Foundation/Foundation.h>     @class Birdname;@interface BirdsListDataController : NSObject@property (nonatomic,copy) NSMutableArray *listofBirds;-(NSUInteger)countOfList;-(Birdname *)objectInListAtIndex:(NSUInteger)theIndex;-(voID)addBirdnameWithname:(Birdname *)bname;@end

BirdsListDataController.m

#import "BirdsListDataController.h"//#import "BirdsListVIEwController.h"#import "Bird.h"@implementation BirdsListDataController-(ID)init{...

我仍然是iOS和Objective C的新手,所以希望我的代码不是太难以排除故障.谢谢您的帮助.

解决方法 我不确定是什么导致了你的问题,但有一些事情:

>在您提供的代码中,没有理由不在BirdListVIEwController.h中导入BirdListDataController.h,因为在BirdListDataController.h中没有对BirdListVIEwControllers的引用.所以尝试用#import语句替换你的@class声明.>在BirdListDataController.h中声明@class Birdname,但在BirdListDataController.m中导入Bird.h而不是Birdname.h.看起来有些东西可能出错了,虽然我必须看到Birdname.h和Bird.h的代码才能确定.

总结

以上是内存溢出为你收集整理的objective-c – Xcode中的未知类型名称(即使使用@class声明)全部内容,希望文章能够帮你解决objective-c – Xcode中的未知类型名称(即使使用@class声明)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1011073.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-22
下一篇2022-05-22

发表评论

登录后才能评论

评论列表(0条)

    保存