這裏之後,我設置一個斷點的代碼(我加入了強制類型究竟比賽我在GDB類型,但它有沒有他們相同的結果):運行代碼返回垃圾;打字調試器返回正確的結果
NSUInteger addedRefOrder = (NSUInteger)[(NSArray*)[sourceMap tileRefsAtX:[addedRef x] y:[addedRef y]] indexOfObject:addedRef];
下面是我在GDB類型:
(gdb) print (NSUInteger)[(NSArray*)[sourceMap tileRefsAtX:[addedRef x] y:[addedRef y]] indexOfObject:addedRef]
$2 = 1
(gdb) print addedRefOrder
$3 = 9223372036854775807
爲了記錄在案,我相當肯定,後者的價值NSNotFound
。這個問題到底意味着什麼?我怎麼開始調試呢?
編輯:我是積極的對象是在數組中。返回了NSNotFound
,但它不正確。下面是在同一個應用程序在別處另一種情況:即行後
NSPoint irisPoint = NSMakePoint([currentObject x], [currentObject y]);
斷點右:
(gdb) print irisPoint
$1 = {
x = 4301764096,
y = 4301764096
}
(gdb) print [currentObject x]
$2 = 4
(gdb) print NSMakePoint([currentObject x], [currentObject y])
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000018
0x00007fff885e010a in objc_msgSend()
該對象位於數組中。 – andyvn22 2011-03-11 00:13:30