2015-12-29 1 views
6

私は画像とテキストでPFQueryTableViewを使用しています。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/BomStorage.c:522]はBOMStorageファイルではありません

と通常のメモリ警告があります。アプリがクラッシュすることがあり、XCodeは、iPhoneへの接続が失われたと主張するメッセージを表示します。メモリ使用量をチェックすると、テーブルが上下に動くにつれて、画面サイズの画像がスクリーンから出るときに解放されないかのようにメモリが増加し続けます。何が起こっている可能性についての任意のアイデア?あなたのURLがBOMStorageファイルより深刻にするwrong.toある場合を除き、ほぼすべてのケースで

答えて

0

が、これは無害である、あなたはこれを追加することができます。

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

以外にも、あなたは他の方法を選択することができます置き換えるために:

[image stretchableImageWithLeftCapWidth:0 topCapHeight:0] forState:UIControlStateNormal]