未找到swift 3 xcode 8'MBProgressHUD.h'文件无法导入桥接头'/myPath/myProj/myProj/myProj-Bridging-Header.h'

时间:2016-10-24 09:29:59

标签: ios objective-c xcode

我正在使用swift 3 xCode 8.我的项目名称是jzy_weather2。

当我尝试从Pod中导入MBProgressHUD.h时,会出现两个错误,一个是MBProgressHUD.h file not found,另一个是failed to import bridging header /myPath/myProj/myProj/myProj-Bridging-Header.h

这是Podfile中的代码,当pod安装

时,下面的两个Podfile块都可以
platform :ios, '10.0'
def myPods
  pod 'MBProgressHUD', '~> 1.0.0'
end

target 'jzy_weather2' do
  use_frameworks!
  myPods

  target 'jzy_weather2Tests' do
    inherit! :search_paths
  end

  target 'jzy_weather2UITests' do
    inherit! :search_paths
  end
end

也尝试这样

platform :ios, '10.0'

def myPods
  pod 'MBProgressHUD', '~> 1.0.0'
end

target 'jzy_weather2' do
  use_frameworks!
  myPods
end

target 'jzy_weather2Tests' do
  myPods
end

target 'jzy_weather2UITests' do
  myPods
end

是用jzy_weather2-Bridging-Header.h

编写的代码
#import "MBProgressHUD.h"

我也尝试过这种语法

#import <MBProgressHUD.h>

我已经阅读了一些像there solutions in StackOverflow这样的解决方案,我不知道我是否在这个链接中找到了一些正确的解决方案,因为其中有太多的解决方案。

这是my Project info,我认为这是适合某个人的正确解决方案,但My two errors仍然会出现

我的配置或代码有什么问题吗? 或者也许在xCode 8中,我应该编写另一种配置?

1 个答案:

答案 0 :(得分:0)

将这些文件拖放到项目中

MBProgressHUD.h

MBProgressHUD.m

你可以找到这个

https://github.com/jdg/MBProgressHUD

它会在你的应用中创建桥接标题

Ex:jzy_weather -Bridging-Header.h

#import&#34; MBProgressHUD.h&#34;

Swift 3

let loadingMBProgress = MBProgressHUD.showAdded(to: self.view, animated: true)

loadingMBProgress.mode = MBProgressHUDMode.indeterminate

loadingMBProgress.label.text = "Loading"

For hide

MBProgressHUD.hide(for: self.view, animated: true)