且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从IOS中的字典数组中删除双重性?

更新时间:2023-12-06 17:07:34

NSSet 是为了保存你的情况。使用:

NSSet is to save you in this case. Use:

NSSet *set = [NSSet setWithArray:duplicateArray];
NSArray *uniqueArray = [set allObjects];

避免使用循环,因为如果你有更多的对象循环是一个消耗过程。你可以直接使用 NSSet ,它肯定会有效。

Avoid using loop for this because if you have more object loop is a consuming process. You can directly use NSSet and it will work for sure.