A previous posting says it was no problem to add one million numbers with a previous beta using this code:
var number = 4915148000000
repeat {
context.addIdentificationEntry(withNextSequentialPhoneNumber: "+" + String(number), label: "Extension: +" + String(number))
number = number + 1
} while number < 4915149000000
However I'm finding thats not the case with beta 4. With an iPhone 6S I can get around 30000-50000. The reason I say around is because the number actually varies. I think the iPhone's internal cache isn't being cleared out, so if you run the extension several times you get a pattern like this:
add 20,000 -> suceeds
add 30,000 -> suceeds
add 40,000 -> suceeds
add 50,000 -> suceeds
add 60,000 -> fails
add 50,000 -> fails
add 40,000 -> fails
etc.
It doesn't malk any sense that the second call of 50,000 or 40,000 would fail when the first suceeds, unless there is some internal cache not being cleared. Once its stars failing I find its necessary to reset the phone.
Note that in the failure scenario above CXCallDirectoryExtensionContextDelegate is NOT being called with an error code of .maximumEntriesExceeded. In fact it doesn't get called at all in this failure scenairo. I've seen it called with error codes of .entriesOutOfOrder and with .duplicateEntires, but it doesn't get called with .maxiumEntriesExceeded.
Here is the modified code from the previous posting used to test how many can be added.
var number = CXCallDirectoryPhoneNumber(4915148000000)
var count = 0
repeat {
context.addIdentificationEntry(withNextSequentialPhoneNumber: number, label: "Extension: +" + String(number))
number = number + 1
count += 1
if (count > 30000)
{
context.completeRequest()
return
}
} while number < 4915149000000
Anyway about 50,000 entires is a large step down from one million and is too few for the commerical products many people have planned. Hope it gets sorted out in a future beta.