我使用Cocoapods安装了Parse iOS api版本1.7.4和ParseUI版本1.1.4。
我在XCode中使用PFQueryTableViewController类来显示Parse.com应用数据库中的项目。我想调用" loadObjects"方法,但自动完成告诉我无法找到方法,也不允许我编译应用程序。
如果我手动转到ParseUI框架,在PFQueryTableViewController.h头文件中,方法loadObjects就在那里。我可以使用这个类中的其他方法。
那为什么Xcode不能找到它?
我尝试从头开始创建一个新项目并再次安装框架,但没有任何运气。
谢谢!
编辑:这是一个示例代码,它从我从头开始创建的项目中无效。
import UIKit
import Parse
import ParseUI
class TableViewController: PFQueryTableViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func updateUI() {
loadObjects() // <- This line has an exclamation mark on Xcode. Autocomplete does not show this method.
}
}
答案 0 :(得分:0)
好的,我发现了问题所在。
ParseUI框架中的loadObjects方法签名是:
- (BFTask *)loadObjects;
由于这个(BFTask *)返回类型,我不得不手动导入代码顶部的Bolts框架。
import UIKit
import Parse
import ParseUI
import Bolts
无论如何,这感觉就像一个解决方法。不必手动导入我在项目中使用的框架所使用的每个框架。 : - (