A = bookmarkArray
B = issueArray
[issueArray addObject:bookmarkArray];
[bookmarkArray removeAllObjects];
Why does this leave issueArray empty, and what can I do to make sure I still have issueArray populated when bookmarkArray is cleared?
You add bookmarkArray directly to issueArray. So then issueArray is an array holding a single object, which is the array bookmarkArray. If you mutate bookmarkArray then you mutate the thing in issueArray.
If you mean to add all the objects currently in bookmarkArray to issueArray then I’d suggest:
If you want to take a copy of bookmarkArray and add it to issueArray then I’d suggest exactly the same thing taskinoor has already suggested:
Or:
If you don’t need the copy to be mutable.