问题
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
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
I tried this answer but NBPhoneNumberDesc.h was already in the Public section:
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:
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?
回答1:
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
NBPhoneNumberUtil.m
file
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
来源:https://stackoverflow.com/questions/56876712/nbphonenumberdesc-h-file-not-found-after-updating-to-xcode-10-2-swift-5