按特定顺序将对象添加到数组?

我有一个带有完成块的4个异步网络请求。 完成后,我希望它们被添加到主NSMutableArray是请求被发送的顺序,但不是它们被接收的顺序(因为这可能是不同的)。 我在发送请求时设置了一个标记,因此我可以在完成块中使用此标记。

采纳答案:

最初用四个NSNull填充数组。 在处理程序中, [yourArray replaceObjectAtIndex:tag withObject:responseObject]

author: chuck

参考更多解答: Add objects to array in a certain order? ,转载请保留出处按特定顺序将对象添加到数组?及作者信息

Statement: We respect knowledge and authors. Since the content comes from the Internet and is intended for scientific research, any reprinters should retain the author's signature and origin. If you are the author of the content and feel in dispute, please contact email: 1076545519@qq.com. We will find out the situation and deal with it in time. We sincerely thank the author for his hard work.


更多:nsmutablearray