是否可以打开存储在NSData对象中的sqlite数据库?
例如:
NSData *sqliteDb = [self fetchDb];
Run Code Online (Sandbox Code Playgroud)
我可以使用sqlite3的内存功能打开这个数据库 - sqlite3_open(":memory:", &db);
我有一个导航控制器,其中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)