libPhoneNumber-iOS
libPhoneNumber-iOS copied to clipboard
get error when call NBPhoneNumberUtil parse method
`
+(bool)checkPhoneNumber: (NSString *)phone {
NBPhoneNumberUtil *phoneUtil = [[NBPhoneNumberUtil alloc] init];
NSError *error = nil;
NBPhoneNumber *phoneNumber = [phoneUtil parse:@"14155552671" defaultRegion:@"US" error:&error];
NSLog(@"- isValidNumber [%@]", [phoneUtil isValidNumber:phoneNumber] ? @"YES" : @"NO");
if (error == nil) {
return [phoneUtil isValidNumber: phoneNumber];
} else {
NSLog(@"Error : %@", [error localizedDescription]);
}
return false;
}
` phoneUtil parse make application crash. and i got an error like below:
'NSInvalidArgumentException', reason: '-[__NSArrayI nb_safeArrayAtIndex:]: unrecognized selector sent to instance 0x60c0003e0800'
in NBPhoneMetadata.m line33
who can give me some help, thanks. libPhoneNumber-iOS (0.9.13)
Getting the same issue. Did anyone get any solution to it?
Same issue...
Found the solution in my case (no ARC project), I have to:
- in PROJECT>TARGETS>myAppTarget>Build Settings>Other Linker Flags Add flag "-ObjC"
- in PROJECT Pods>TARGETS>libPhoneNumber-iOS>Build Phases>Compile Sources Add Compiler Flags for each file "-fobjc-arc" Works perfect now.
I'm seeing this issue too
crash is in NBPhoneMetaData.m
at line 33
_generalDesc = [[NBPhoneNumberDesc alloc] initWithEntry:[entry nb_safeArrayAtIndex:1]];
@slebreton38 your fix didnt make any difference to my app (even after cleaning and clearing derived data)
Had same issue. Tried the "-fobjc-arc" solution above to no avail. I looked into the method nb_safeArrayAtIndex
and XCode directed me to the file "NSArray+NBAdditions.h" which came in the submodule update folder. But the same file's .m was not listed in my compile sources. When I added the file "NSArray+NBAdditions.m" to project compile sources, the crash stopped happening. Cheers!