The NSMutableIndexSet addIndex:
method expects a type of NSUInteger
which is an unsigned long
.
When building a 32-bit app, this is a 32-bit value. When you build for 64-bit, it is a 64-bit value.
Your threadId
is a 64-bit value. Unless you are building a 64-bit iOS app, it is possible that many of the possible thread id values will be too large to fit in the 32-bit NSUInteger
value, hence the error.
Why are you using an index set to hold a set of thread ids? Why not use a NSMutableSet
or NSMutableArray
?
Then you can do:
NSMutableSet *threadIds = [NSMutableSet set];
for (Thread *thread in threads) {
uint64_t threadId = thread.threadId; //the threadId does exist
[threadIds addObject:@(threadId)];
}
[threadIds enumerateObjectsUsingBlock:^(NSNumber *threadId, BOOL *stop) {
[self removeThreadForFolder:folder threadId:[threadId unsignedLongLongValue]];
}];