This is crashing because you are using int
not because of memcpy
. Try replacing the int
with NSInteger
and it should work. You can find more information here.
The iPhone5S uses a 64bit architecture while the others use 32bit. One of the core differences between the two is how the system handles integers as explained in the doc. Your code is using unsigned int
which does not mean the same thing on 32bit and on 64bit and that results in a crash. You should change your int
called i
and j
to NSIntegers
and I believe your code will work. Or come to think of it you can try to simply replace the word int
by long
.