Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Disclaimer</h2> <p>I cannot tell you how it works — the fact, that <code>NSDataDetector</code> inherits <code>NSRegularExpression</code> <em>may suggest</em> that it uses a set of regular expressions, but I honestly doubt that (e.g. the detector for date-types uses information that is sprinkled throughout longer blocks of text, so that it appears more likely that there is some natural language clustering and processing going on under the hood).</p> <p>The main reason why it works better with American addresses, I suppose, is as simple as it is boring:</p> <p><strong>Apple is a US-based company</strong> and (with the exception of Jonathan Ive, who is British) every of its top-level executives is a North-American. Therefore, it's of little surprise that their approach is "US/North-American First" [1].</p> <p>It's the reason why the design of the power-brick is so elegant when using the compact US connector (where the prongs fold in) — and looks so clumsy with almost any other...</p> <p>The other reason is that Apple — like anyone else — ships as soon as they can:<br> If they have something working for their US customers but not for the rest, why not ship it for <em>them</em> and add support for other locales via software updates later?</p> <p>With regards to your problem, what <em>may</em> or <em>may not</em> help (read: "I didn't bother testing") with the detection of addresses is that the user set the locale of their device appropriately.</p> <p>If — and only if — you find out that this has a positive impact on your results, you could then check whether the country part of <code>[[NSLocale currentLocale] localeIdentifier]</code> equals <code>IN</code> and (in case it doesn't) prompt the user to change that in the "Settings" app, otherwise.</p> <p>If that's not proving to be useful, you've got to <em>Roll-Your-Own™</em>...</p> <hr> <p>(1) The major notable exception to this rule was the choice of the base-band technology for the original iPhone, where favoring GSM over CDMA may have been a disadvantage <em>locally</em> but the key to success <em>globally</em>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload