Giter Site home page Giter Site logo

rmaddy / rmphoneformat Goto Github PK

View Code? Open in Web Editor NEW
266.0 10.0 61.0 225 KB

RMPhoneFormat provides a simple to use class for formatting phone numbers in iOS apps. The formatting should replicate what you would see in the Contacts app for the same phone number.

Objective-C 100.00%

rmphoneformat's Issues

Crashing on launch

Hi there, I have followed the instructions and added the PhoneFormats.dat file, but the sample project throws an exception and crashes on launch for me on line 1078 of RMPhoneFormat.m, in the parseDataHandler method:

    [_countryCallingCode setObject:callingCode forKey:country];

Reason is "setObjectForKey: key can not be nil"

Any advice? Thanks!

Formatting while editing phone number

I am trying to achieve UITextField with formatted phone number while user input progress.
My algo:

  1. Get only digits from phone field
  2. Format digits as phone number
  3. Set UITextFields text property new formatted phone number

All works fine, until user tries to edit phone number in the middle.
I can not properly save and restore selectedRange because of formatting chars " -()"

Is there any solution for this problem?

Missing dat file

i just downloaded the project and whenever i tries to run it says missing the dat file and it crashes. badly need help.

Validation?

Good work! This is very interesting and useful class.

One quick question:
How can I check if a string is valid as a phone number?

I know how to format, but couldn't find how to validate.

Thanks

Austrian number not properly validated

I tried to validate/format the Austrian number +43 7226 3180. The formatting is as in the Contacts App. But the RMPhoneFormat tells me, that the number is invalid.

ios simulator screen shot 16 jan 2014 14 28 21

Add CallingCodeInfo object to public interface

it would be cool if there was a way to grab the updated CallingCodeInfo object from an instance of RMPhoneFormat so the client can easily grab parsed information about the current string thats being processed.

I can make the change if you don't see anything architecturally incorrect

callingCodeForCountryCode returning NULL

  • Running this function on country codes from [NSLocale ISOCountryCodes]
  • I suspect the Default.phoneformat file could be missing something? I am getting the file from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AppSupport.framework/
    RMPhoneFormat *format = [RMPhoneFormat instance];

    NSMutableArray *invalidCodes = [[NSMutableArray alloc] init];

    for (NSString *countryCode in [NSLocale ISOCountryCodes])
    {
        NSString *callingCode = [format callingCodeForCountryCode:countryCode];
        if (!callingCode) [invalidCodes addObject:countryCode];
    }

    NSLog(@"invalidCodes: %@", invalidCodes);

invalidCodes: (
    AX,
    BL,
    BQ,
    BV,
    CC,
    CW,
    CX,
    EH,
    GG,
    GS,
    HM,
    IM,
    JE,
    MF,
    NF,
    PN,
    SJ,
    SS,
    TF,
    TL,
    UM,
    YT
)

Validation for some international telephone numbers not working

Hi,

I'm glad I found this little utility of yours, am impressed by the "on-the-fly" formatting, but am having some issues with phone number validation for some countries.

My initial tests show that the validation doesn't work at all for Italy (valid number shows as invalid) or Germany (while typing the number it shows up valid at the halfway point but not when complete).

I used the PhoneFormats.dat file from the sdk9.3 simulator.

Would it help to try a different formats file or are there known issues with these numbers?

Thanks for any help. I'd really like to get this working!

AppStore Validation Issue

Hi,

Using this lib causes issue while validating a project for App Store submission. I believe it's a false positive but could you change the name of the method so it doesn't raise a flag?

Thanks!

d7crw

Indian phone number not properly formatted and validated

I tried to validate/format the Indian number (ex: +91 7702227774, +91 9966496003). But the formatting is not as in the Contacts App and also the RMPhoneFormat tells me, that the number is invalid. Please find below screenshots (BTW, green is valid and red color is not valid in below screenshots).

img_2393
ios simulator screen shot 19-nov-2014 3 04 18 pm
img_2394

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.