The*_*imp 2 uiview mbprogresshud swift ios9 bridging-header
我有一个swift项目,我正在MBProgressHUD通过桥接头文件使用.我遇到的问题是,UIView似乎没有被认为是类型,我不知道为什么.
在我的桥接标题中,我有:
#import "MBProgressHUD.h"
Run Code Online (Sandbox Code Playgroud)
我尝试构建时遇到的错误都是一致的:
Cannot find interface declaration for 'UIView', superclass of MBProgressHUD.
Run Code Online (Sandbox Code Playgroud)
我检查了MBProgressHUD文件,我可以看到它肯定会导入以下内容:
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CoreGraphics/CoreGraphics.h>
#import "MBProgressHUD.h"
#import "CSNotificationView.h"
Run Code Online (Sandbox Code Playgroud)
还有其他人看过类似的问题吗?如果是,您是否知道问题所在以及如何解决?
小智 7
我也遇到了同样的问题,这就是我用swift 2使用MBProgressHud所做的
1)指定use_frameworks!在你的Podfile中使用框架.
2)在你的桥接头中添加#import,使用尖括号而不是双引号,例如 -
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CoreGraphics/CoreGraphics.h>
#import <MBProgressHUD/MBProgressHUD.h>
Run Code Online (Sandbox Code Playgroud)
3)在你的swift文件中也导入MBProgressHUD例如
import UIKit
import MBProgressHUD
Run Code Online (Sandbox Code Playgroud)
现在你可以使用MBProgressHud了 -
MBProgressHUD.showHUDAddedTo(self.view, animated: true);
Run Code Online (Sandbox Code Playgroud)
希望它会有所帮助.
| 归档时间: |
|
| 查看次数: |
2118 次 |
| 最近记录: |