小编Kri*_*a K的帖子

打开存储在NSData对象"内存中"的sqlite数据库

是否可以打开存储在NSData对象中的sqlite数据库?

例如:

NSData *sqliteDb = [self fetchDb];
Run Code Online (Sandbox Code Playgroud)

我可以使用sqlite3的内存功能打开这个数据库 - sqlite3_open(":memory:", &db);

sqlite nsdata ios

5
推荐指数
0
解决办法
209
查看次数

MKMapView不会为MKUserLocation释放内存

我有一个导航控制器,其中VC1将VC2推送到导航堆栈.VC2在基于选项卡的视图中有一个MKMapView,用户位置已打开.当我使用Heapshot Analysis工具检查仪器的重复分配时,我重复发现当我回到VC1时,一些MKUserLocation对象没有被释放. 在此输入图像描述

我删除了所有注释,并在dealloc时禁用了用户位置.这种堆增长的原因是什么?

将VC2推送到导航堆栈的VC1代码:

- (NSIndexPath *)tableView:(UITableView *)tableView 
  willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    VC2 *vc2 = [[VC2 alloc] init];
    vc2.index = indexPath.row;
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    [[self navigationController] pushViewController:vc2 
                                           animated:YES];
    [vc2 release];
    vc2 = nil;
    return nil;
}
Run Code Online (Sandbox Code Playgroud)

VC2中的dealloc代码:

- (void)dealloc {
//Other UILabel, UITextField objects dealloc methods go here
//The next four lines of code do not make a difference even if they are in viewWillDisappear
[self.mapView removeAnnotations:self.mapView.annotations];
[self.mapView.layer removeAllAnimations];
self.mapView.showsUserLocation = NO;//This line does not make a difference in heapshot
mapView.delegate …
Run Code Online (Sandbox Code Playgroud)

instruments mkmapview ipad ios heapshot

4
推荐指数
1
解决办法
2171
查看次数

标签 统计

ios ×2

heapshot ×1

instruments ×1

ipad ×1

mkmapview ×1

nsdata ×1

sqlite ×1