4

I'm using pod chronotruck/FlagPhoneNumber I just updated from High Sierra/Xcode 10.1/Swift 4.2/Cocoapoods v-1.5.3 to Mojave 10.14.15/Xcode 10.2.1/Swift 5/Cocoapoods v-1.7.3 and I can't build because inside the NBRegExMatcher.m file I get the error

'NBPhoneNumberDesc.h' file not found

enter image description here

Everything worked fine before the upgrade and I never had any of these errors.

The Podfile.lock has this inside of it:

- FlagPhoneNumber (0.7.6):
- FlagPhoneNumber/libPhoneNumberiOS (= 0.7.6)
- FlagPhoneNumber/libPhoneNumberiOS (0.7.6)

The odd thing is there are several other files from that pod that also use the #import "NBPhoneNumberDesc.h" module but they all work fine and there aren't any errors

enter image description here

I tried this answer but NBPhoneNumberDesc.h was already in the Public section:

enter image description here

I also tried this answer to set the SWIFT_OBJC_INTERFACE_HEADER_NAME to match the my project's bridging header but nothing

Inside the NBRegExMatcher.m file (where the error is occurring) I commented out #import NBPhoneNumberDesc.h to see what would happen and then NBPhoneNumberUtil.h got the same error:

enter image description here

I notice the libPhoneNumber-iOS came bundled inside the FlagPhoneNumber pod and it's version is libPhoneNumberiOS (0.7.6). I then manually added the pod to my project to see what would happen but it also made no difference, the error was still there. The only thing I noticed is when I added the pod manually the Podfile.lock version is - libPhoneNumber-iOS (0.9.15) wherein as the version that FlagPhoneNumber is using is libPhoneNumberiOS (0.7.6)

Any idea how can i fix this error?

Lance Samaria
  • 17,576
  • 18
  • 108
  • 256

1 Answers1

5

I tried a bunch of answers about changing things inside Build Settings > Header File and/or User Header files but none of them worked. I followed this answer and it worked :)

What I had to do was change the #import SomeFile.h to #import <SomeFile.h> by using the brackets instead.

Here is the code from each file

Inside the NBRegExMatcher.m file I had to change these 2 modules:

//#import "NBPhoneNumberDesc.h" // comment this out and add the brackets below
#import <NBPhoneNumberDesc.h>
//#import "NBPhoneNumberUtil.h" // comment this out and add the brackets below
#import <NBPhoneNumberUtil.h>

After I changed those I also got the same error inside the NBPhoneNumberUtil.m and had to do the same there:

//#import "NBRegExMatcher.h" // comment this out and add the brackets below
#import <NBRegExMatcher.h>

Here are pictures of each:

NBRegExMatcher.m file enter image description here

NBPhoneNumberUtil.m file enter image description here

On a side note I also had to add the pod 'libPhoneNumber-iOS', '~> 0.8' to my Podfile because a different error appeared becuase I uised the library outside of the FlagPhoneNumber pod

Lance Samaria
  • 17,576
  • 18
  • 108
  • 256