parse-platform - PFQueryTableView 内存

标签 parse-platform pfquerytableviewcontrolle

我一直在使用 PFQueryTableView带有图片和文字。执行此代码后:

-  (id)initWithCoder:(NSCoder *)aDecoder {
     self = [super initWithClassName:@"Story"];
     self = [super initWithCoder:aDecoder];
   if (self) { // This table displays items in the Todo class
       self.parseClassName = @"Story";
       self.pullToRefreshEnabled = YES;
       self.paginationEnabled = YES;
       self.objectsPerPage = 25;
   }
  return self;
 }

- (PFQuery *)queryForTable {
PFQuery *query = [PFQuery queryWithClassName:self.parseClassName];

if (self.objects.count == 0) {
    query.cachePolicy = kPFCachePolicyCacheThenNetwork;
}
[query orderByDescending:@"createdAt"];


return query;
 }


 - (UITableViewCell *)tableView:(UITableView *)tableView
     cellForRowAtIndexPath:(NSIndexPath *)indexPath
                    object:(PFObject *)object {
static NSString *cellIdentifier = @"cell";

PFTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
    cell = [[PFTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
                                  reuseIdentifier:cellIdentifier];
}

// Configure the cell to show todo item with a priority at the bottom
cell.textLabel.text = object[@"snapDetails"];

PFFile *thumbnail = [object objectForKey:@"snap"];
cell.imageView.image = [UIImage imageNamed:@"placeholder.jpg"];
cell.imageView.file = thumbnail;
return cell;
}

日志给了我这个奇怪的警告:

[/BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreUI/CoreUI-
371.4/Bom/Storage/BOMStorage.c:522] is not a BOMStorage file



以及定期的内存警告。有时应用程序也会崩溃和 XCode显示一条消息,声称它已失去与我的 iPhone 的连接.在检查内存使用情况时,随着表格的上升或下降,内存继续增加,就好像图像(屏幕大小)在离开屏幕时永远不会释放一样。关于可能发生什么的任何想法?

最佳答案

几乎在所有情况下,这都是无害的,除非您的 url 错误。要使 BOMStorage 文件更严重,您可以添加以下内容:

urlString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];

此外,您可以选择其他方法来替换:
[image stretchableImageWithLeftCapWidth:0 topCapHeight:0]  forState:UIControlStateNormal]

关于parse-platform - PFQueryTableView 内存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34504927/

相关文章:

ios - 未找到外部框架文件/File.h (Parse/Parse.h) 文件

ios - 为 PF Query TableViewController 设置背景图片

swift - PFQueryTableViewController 查询指向 User 类的指针并将其作为用户名标签放入表中(Swift,Parse)

ios - didSelectRowAtIndexPath 方法与使用 Swift 2 的 Parse 中的 Load More 函数冲突

ios - 从Parse.com流音频-没有检索到数据?

ios - (解析)更新 pfobject 时出错

swift - Admob BannerView 浮在 PFQueryTableViewController 上

ios - 如何返回一个零自定义 UITableViewCell

swift - 我的 Parse 登录和注册遇到问题

ios - 从 iOS 应用程序将电子邮件地址订阅到 MailChimp