How to find and remove strings in nsdata

54 Views Asked by At

I'm working on converting vcard to cncontact.

I'm using CNContactVCardSerialization.contacts(with data: Data).

However, when I tried to import 4000 contacts using that method, I was only able to import 450.

The debug console displays:

Incorrect NSStringEncoding value 0x0 detected. Assuming NSASCIIStringEncoding.

A warning appears saying:

Will stop this compatibility mapping behavior in the near future.

Perhaps there are incorrect characters in the string saved in the contacts. So I want to remove the contacts that are causing the error.

Is it possible to remove incorrect encoding from data converted to NSData format?

I don't know if I can remove the incorrect encoding using the drop(while:) function after changing NSData to Data.

0

There are 0 best solutions below