【发布时间】:2014-04-05 23:51:34
【问题描述】:
OS x 和 Objective C 的新手。我的程序出现崩溃,来自多个用户报告,我无法在我的机器上重现它。
Feb 22, 2014, 9:06:44 AM: An uncaught exception was raised
Feb 22, 2014, 9:06:44 AM: *** -[NSArray getObjects:range:]: range {3392, 16} extends beyond bounds for empty array
Feb 22, 2014, 9:06:44 AM: (
0 CoreFoundation 0x00007fff8f05541c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff94c12e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8ef9bc9f -[NSArray getObjects:range:] + 271
3 CoreFoundation 0x00007fff8ef9da63 -[NSArray countByEnumeratingWithState:objects:count:] + 163
4 MYAppMac 0x00000001000037b9 +[ITunesProvider getITunesMediaFiles:] + 5209
线路崩溃线指向这个for循环
// Get tracks from iTunesUserPlaylist
SBElementArray *fileTracks = [list fileTracks];
for(iTunesFileTrack* track in fileTracks)
{
// my code here. I do not modify filetracks anywhere in the loop
}
for 循环遍历数组中的项目,但在某些时候它会在尝试访问更下方的项目时崩溃。我根本不修改 fileTracks 数组。有什么想法吗?
【问题讨论】:
标签: objective-c macos itunes