0

I want to know if Apple will reject this solution or not for getting the unique id in Xamarin iOS?

public string GetIdentifier()
{
    enter code here`var query = new SecRecord(SecKind.GenericPassword);
    query.Service = NSBundle.MainBundle.BundleIdentifier;
    query.Account = "UniqueID";

    NSData uniqueId = SecKeyChain.QueryAsData(query);
    if (uniqueId == null)
    {
        query.ValueData = NSData.FromString(System.Guid.NewGuid().ToString());
        var err = SecKeyChain.Add(query);
        if (err != SecStatusCode.Success && err != SecStatusCode.DuplicateItem)
            throw new Exception("Cannot store Unique ID");
        return query.ValueData.ToString();
    }
    else
    {
        return uniqueId.ToString();
    }
}
Snostorp
  • 544
  • 1
  • 8
  • 14
kefi Kefi
  • 128
  • 10

1 Answers1

1

Will Apple reject this solution for getting unique id in Xamarin iOS?

Apple may reject apps that uses private framework/api .

However ,the related framework you used in the code is Security , it is public .

So , the answer is : No .

ColeX
  • 14,062
  • 5
  • 43
  • 240