【发布时间】:2015-04-20 14:00:41
【问题描述】:
我收到标记行的“在初始化期间存储到'beaconsData'的值从未被读取”消息,我不太明白为什么会发生这种情况。
- (void)locationManager:(KTKLocationManager *)locationManager didRangeBeacons:(NSArray *)beacons
{
//NSLog(@"Ranged beacons count: %lu", [beacons count]);
_beaconKontaktArr = [[NSMutableArray alloc] init];
for (CLBeacon *beacon in beacons) {
NSDictionary *beaconsData = [[NSDictionary alloc] init]; //problem is there
KTKBeacon *beaconData = [self _getDataForBeacon:beacon];
if (beaconData)
{
beaconsData = @{@"beacon": beacon, @"ktkBeacon": beaconData};
[_beaconKontaktArr addObject:beaconsData];
}
}
}
【问题讨论】:
-
您不需要在这里分配、初始化信标数据,因为您已经在 if 语句中使用 @{}。
标签: ios objective-c memory-leaks