我有一个swift
项目,我正在MBProgressHUD
通过桥接头文件使用它。我遇到的问题是UIView
似乎没有被识别为类型,我也不知道为什么。
在我的桥接标题中,我有:
#import "MBProgressHUD.h"
我尝试构建时遇到的错误都是相同的:
Cannot find interface declaration for 'UIView', superclass of MBProgressHUD.
我已经检查了MBProgressHUD文件,可以看到它确实导入了以下内容:
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CoreGraphics/CoreGraphics.h>
#import "MBProgressHUD.h"
#import "CSNotificationView.h"
还有其他人看到过类似的问题吗?如果是这样,您是否知道问题是什么,我该如何解决?
我也遇到了同样的问题,这就是我在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>
3)在您的快速文件中还导入MBProgressHUD,例如
import UIKit
import MBProgressHUD
现在您可以像这样使用MBProgressHud了-
MBProgressHUD.showHUDAddedTo(self.view, animated: true);
希望它会有所帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句