更新到 Xcode 10.2、Swift 5 后,`'NBPhoneNumberDesc.h' 找不到文件`
`'NBPhoneNumberDesc.h' file not found` after updating to Xcode 10.2, Swift 5
我正在使用 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
文件中我收到错误
'NBPhoneNumberDesc.h' file not found
升级前一切正常,我从未遇到过任何这些错误。
Podfile.lock里面有这个:
- FlagPhoneNumber (0.7.6):
- FlagPhoneNumber/libPhoneNumberiOS (= 0.7.6)
- FlagPhoneNumber/libPhoneNumberiOS (0.7.6)
奇怪的是,该 pod 中还有其他几个文件也使用 #import "NBPhoneNumberDesc.h"
模块,但它们都工作正常并且没有任何错误
我试过 但 NBPhoneNumberDesc.h 已经在 Public 部分:
我也尝试 this answer 设置 SWIFT_OBJC_INTERFACE_HEADER_NAME 以匹配我的项目的桥接 header 但什么都没有
在 NBRegExMatcher.m
文件中(发生错误的地方)我注释掉了 #import NBPhoneNumberDesc.h
以查看会发生什么,然后 NBPhoneNumberUtil.h 得到了同样的错误:
我注意到 libPhoneNumber-iOS
捆绑在 FlagPhoneNumber
pod 中,它的版本是 libPhoneNumberiOS (0.7.6)
。然后我手动 added the pod 我的项目,看看会发生什么,但它也没有什么区别,错误仍然存在。我唯一注意到的是,当我手动添加 pod 时,Podfile.lock 版本是 - libPhoneNumber-iOS (0.9.15)
,其中 FlagPhoneNumber 使用的版本是 libPhoneNumberiOS (0.7.6)
知道如何解决这个错误吗?
我尝试了一堆关于在 Build Settings > Header File and/or User Header files 中更改内容的答案,但其中 none 有效。我关注了 this answer 并且成功了:)
我要做的是使用方括号将 #import SomeFile.h
更改为 #import <SomeFile.h>
。
这是每个文件的代码
在 NBRegExMatcher.m
文件中,我必须更改这两个模块:
//#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
中也遇到了同样的错误,并且不得不在那里做同样的事情:
//#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 pod[= 之外使用了库22=]
我正在使用 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
文件中我收到错误
'NBPhoneNumberDesc.h' file not found
升级前一切正常,我从未遇到过任何这些错误。
Podfile.lock里面有这个:
- FlagPhoneNumber (0.7.6):
- FlagPhoneNumber/libPhoneNumberiOS (= 0.7.6)
- FlagPhoneNumber/libPhoneNumberiOS (0.7.6)
奇怪的是,该 pod 中还有其他几个文件也使用 #import "NBPhoneNumberDesc.h"
模块,但它们都工作正常并且没有任何错误
我试过
我也尝试 this answer 设置 SWIFT_OBJC_INTERFACE_HEADER_NAME 以匹配我的项目的桥接 header 但什么都没有
在 NBRegExMatcher.m
文件中(发生错误的地方)我注释掉了 #import NBPhoneNumberDesc.h
以查看会发生什么,然后 NBPhoneNumberUtil.h 得到了同样的错误:
我注意到 libPhoneNumber-iOS
捆绑在 FlagPhoneNumber
pod 中,它的版本是 libPhoneNumberiOS (0.7.6)
。然后我手动 added the pod 我的项目,看看会发生什么,但它也没有什么区别,错误仍然存在。我唯一注意到的是,当我手动添加 pod 时,Podfile.lock 版本是 - libPhoneNumber-iOS (0.9.15)
,其中 FlagPhoneNumber 使用的版本是 libPhoneNumberiOS (0.7.6)
知道如何解决这个错误吗?
我尝试了一堆关于在 Build Settings > Header File and/or User Header files 中更改内容的答案,但其中 none 有效。我关注了 this answer 并且成功了:)
我要做的是使用方括号将 #import SomeFile.h
更改为 #import <SomeFile.h>
。
这是每个文件的代码
在 NBRegExMatcher.m
文件中,我必须更改这两个模块:
//#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
中也遇到了同样的错误,并且不得不在那里做同样的事情:
//#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 pod[= 之外使用了库22=]