xamarinxamarin.formsxamarin.iosxamarin.ios-binding

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


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();
    }
}

Solution

  • 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 .