更新到Xcode 10.2,Swift 5后,找不到“'NBPhoneNumberDesc.h'文件" [英] `'NBPhoneNumberDesc.h' file not found` after updating to Xcode 10.2, Swift 5

查看:113
本文介绍了更新到Xcode 10.2,Swift 5后,找不到“'NBPhoneNumberDesc.h'文件"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用pod chronotruck/FlagPhoneNumber 我刚刚从High Sierra/Xcode 10.1/Swift 4.2/Cocoapoods v-1.5.3更新到Mojave 10.14.15/Xcode 10.2.1/Swift 5/Cocoapoods v-1.7.3并无法构建,因为在NBRegExMatcher.m文件中出现错误

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"文件

'NBPhoneNumberDesc.h' file not found

在升级之前,一切正常,而且我从未遇到任何这些错误.

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

Podfile.lock内部包含以下内容:

The Podfile.lock has this inside of it:

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

奇怪的是,该Pod中还有其他几个文件也使用#import "NBPhoneNumberDesc.h"模块,但它们都可以正常工作,并且没有任何错误

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

我尝试了此答案,但是NBPhoneNumberDesc.h已经在公共"部分中了:

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

我还尝试了此答案,将SWIFT_OBJC_INTERFACE_HEADER_NAME设置为与我项目的桥接头匹配,但没有任何匹配

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

NBRegExMatcher.m文件中(发生错误的地方),我注释了#import NBPhoneNumberDesc.h以查看会发生什么,然后NBPhoneNumberUtil.h遇到了相同的错误:

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:

我注意到libPhoneNumber-iOS捆绑在FlagPhoneNumber吊舱内,它的版本是libPhoneNumberiOS (0.7.6).然后,我将添加了pod 到我的项目中,以查看会发生什么,但也没有任何区别,错误仍然存​​在.我唯一注意到的是,当我手动添加Pod时,Podfile.lock版本为- libPhoneNumber-iOS (0.9.15),其中FlagPhoneNumber使用的版本为libPhoneNumberiOS (0.7.6)

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)

知道如何解决此错误吗?

推荐答案

我尝试了一些有关更改构建设置">头文件"和/或用户头"文件中内容的答案,但它们均无效.我遵循了此答案,它起作用了:)

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 :)

我要做的是改为使用括号将#import SomeFile.h更改为#import <SomeFile.h>.

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

这是每个文件中的代码

NBRegExMatcher.m文件中,我必须更改以下2个模块:

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>

在更改了这些内容之后,我在NBPhoneNumberUtil.m内也遇到了相同的错误,并且不得不在该处执行相同的操作:

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>

以下是每个图片:

NBRegExMatcher.m文件

NBPhoneNumberUtil.m文件

在旁注中,我还必须将pod 'libPhoneNumber-iOS', '~> 0.8'添加到我的Podfile中,因为出现了一个不同的错误,因为我在FlagPhoneNumber窗格外部使用了库

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

这篇关于更新到Xcode 10.2,Swift 5后,找不到“'NBPhoneNumberDesc.h'文件"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆