gpt4 book ai didi

objective-c - 'NSMutableArray' 没有可见的 @ 接口(interface)声明选择器 'appendData:'

转载 作者:行者123 更新时间:2023-12-03 16:52:36 25 4
gpt4 key购买 nike

我在我的 iOS 应用程序中使用 EGOTableViewPullRefresh 库。为了实现它,我必须将原始类从 UIViewController 的子类更改为 UITableViewController。这显然打破了我存储数据的方式,例如在 NSMutableArray 中。

标题:

#import <UIKit/UIKit.h>
#import "EGORefreshTableHeaderView.h"

@interface PullViewController : UITableViewController <EGORefreshTableHeaderDelegate, UITableViewDelegate, UITableViewDataSource>{

NSArray *news;
NSMutableArray *data;

EGORefreshTableHeaderView *_refreshHeaderView;

// Reloading var should really be your tableviews datasource
// Putting it here for demo purposes
BOOL _reloading;
}

- (void)reloadTableViewDataSource;
- (void)doneLoadingTableViewData;

@end

实现:

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{
data = [[NSMutableData alloc] init];
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)theData{
[data appendData:theData];
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
news = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
[self.tableView reloadData];
[DejalBezelActivityView removeViewAnimated:YES];
}

最佳答案

我不明白你怎么可能使用 NSMutableArray 而不是 NSMutableData。事实上,您只是实例化一个 NSMutableData。因此,将您的 ivars 类中的数据声明更改为 NSMutableData 类型。

关于objective-c - 'NSMutableArray' 没有可见的 @ 接口(interface)声明选择器 'appendData:',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13784916/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com