Remove Duplicates in NSArray

Joined
Jan 21, 2017
Messages
1
Reaction score
0
Points
1
Hi All,

I am trying to update an small part of an app and the last bit to do is remove duplicates from and array by their value. My array is as below, the key "title" has many duplicates and I want to remove them so there are no duplicate titles in the array.

Code:
"<DCode: 0x17028
2017-01-21 16:09:14.233522 M-Code[1750:994133] (
    "<DCode: 0x17009f5e0> (entity: DCode; id: 0xd000000005680000 <x-coredata://01C37C8D-468B-47D5-9C18-5FACCF313A81/DCode/p346> ; data: {\n    filePath = nil;\n    fileUrl = \"http://domain.companel/uploads/qrcodes/48_agency_qr.png\";\n    keyword = nil;\n    logo = nil;\n    logoUrl = \"http://domain.com/panel/uploads/logo-small_1480159225.png\";\n    qrCode = nil;\n    title = Agency;\n})",<DCode: 0x17028
2017-01-21 16:09:14.233522 M-Code[1750:994133] (
    "<DCode: 0x17009f5e0> (entity: DCode; id: 0xd000000005680000 <x-coredata://01C37C8D-468B-47D5-9C18-5FACCF313A81/DCode/p346> ; data: {\n    filePath = nil;\n    fileUrl = \"http://domain.companel/uploads/qrcodes/48_agency_qr.png\";\n    keyword = nil;\n    logo = nil;\n    logoUrl = \"http://domain.com/panel/uploads/logo-small_1480159225.png\";\n    qrCode = nil;\n    title = Agency;\n})",<DCode: 0x17028
2017-01-21 16:09:14.233522 M-Code[1750:994133] (
    "<DCode: 0x17009f5e0> (entity: DCode; id: 0xd000000005680000 <x-coredata://01C37C8D-468B-47D5-9C18-5FACCF313A81/DCode/p346> ; data: {\n    filePath = nil;\n    fileUrl = \"http://domain.companel/uploads/qrcodes/48_agency_qr.png\";\n    keyword = nil;\n    logo = nil;\n    logoUrl = \"http://domain.com/panel/uploads/logo-small_1480159225.png\";\n    qrCode = nil;\n    title = Something Else;\n})",

I want to keep the array as it is but for the example above their should only be 2 items in the array, "Something" and "Agency" as currently "Agency" is repeated.

This creates the array
Code:
cards = [DCode MR_findAllSortedBy:@"title" ascending:YES];

Any help is appreciated.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top