简体   繁体   中英

Application crash on 64 bit

Recently I have transitioned my application to 64 bit and have started seeing few crashes with below message in the crash report:

-[__NSArrayI objectAtIndex:]: index 18446744073709551615 beyond bounds [0 .. 0]'

Crash report is pointing to below piece of code but when I run it in debug, it do not crash for me. Anyone faced the similar issue?

NSArray *allViewControllers = self.firstModalViewController.viewControllers;
UIViewController *aViewController = allViewControllers[allViewControllers.count - 2];

The objectAtIndex: method takes a NSUInteger. As specified in the docs you have a 64 bit unsigned integer in 64 bit application.

When building 32-bit applications, NSUInteger is a 32-bit unsigned integer. A 64-bit application treats NSUInteger as a 64-bit unsigned integer

You are trying to access the index (64^2)-2

To be honest, reading the code provided, i can't say that is a 64 bit related problem. It seems that you are accessing that array before that it is filled with something.

Have you tried to print the array with the debugger?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM