应用程序未进入快速枚举循环
经过多次调试,我确定这段代码忽略了快速枚举循环并盲目地跳到末尾:
-(void)loadOutAnnotations
{
NSLog(@"entering Annotation enumeration Loop");
iProspectFresno_LiteAppDelegate *appDelegate =(iProspectFresno_LiteAppDelegate *)[[UIApplication sharedApplication] delegate];
FlipsideViewController *viewController = (FlipsideViewController *)[[UIApplication sharedApplication] delegate];
CLLocationCoordinate2D workingCoordinate;
NSLog(@"initializing");
NSMutableArray* mines = [[NSMutableArray alloc] initWithArray(NSMutableArray *)appDelegate.mines];
for (id mine in mines)
{
NSLog(@"in the loop");
//rest of loop code
}
}
控制台打印“进入注释枚举循环”以及“初始化”,但它似乎完全绕过了枚举循环,因为它不是“在循环中”打印。我做错了什么?
after much debugging, I have determined that this code is ignoring the fast enumeration loop and blindly jumping to the end:
-(void)loadOutAnnotations
{
NSLog(@"entering Annotation enumeration Loop");
iProspectFresno_LiteAppDelegate *appDelegate =(iProspectFresno_LiteAppDelegate *)[[UIApplication sharedApplication] delegate];
FlipsideViewController *viewController = (FlipsideViewController *)[[UIApplication sharedApplication] delegate];
CLLocationCoordinate2D workingCoordinate;
NSLog(@"initializing");
NSMutableArray* mines = [[NSMutableArray alloc] initWithArray(NSMutableArray *)appDelegate.mines];
for (id mine in mines)
{
NSLog(@"in the loop");
//rest of loop code
}
}
the console prints "entering Annotation enumeration Loop" as well as the "initializing," but it seems to bypass the enumeration loop completely, as it is not printing "in the loop." what am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确定
appDelegate.mines
不为空吗?Are you sure
appDelegate.mines
is not empty?