本文介绍了PFObject 在 Xcode 6.0.1、Yosemite GM3 中没有名为“saveInBackground"的成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Parse 在 Yosemite 中表现得很奇怪,saveInBackground 声称不是 PFObject 的成员.

Parse is acting very strangely in Yosemite, saveInBackground claims to not be a member of PFObject.

var score = PFObject(className: "score")
    score.setObject("Mo", forKey: "name")
    score.setObject(1, forKey: "scoreCount")
    score.saveInBackground()

显然这应该可行,也许这是 Xcode 6.0.1 或 Yosemite GM3(或组合)的问题.需要明确的是,使用 saveInBackgroundWithBlock 工作正常.

Clearly this should work, perhaps it's an issue with Xcode 6.0.1 or Yosemite GM3 (Or a combination). To be clear, using saveInBackgroundWithBlock works fine.

有没有其他人遇到过这个或类似的奇怪错误?

Has anyone else experienced this or a similarly weird bug?

推荐答案

saveInBackground 方法在头中声明,返回一个 BFTask * 对象,它是螺栓框架.确保你的项目链接了 Bolts 框架,然后添加

The saveInBackground method is declared in the header to return a BFTask * object, which is part of the Bolts framework. Make sure your project is linking the Bolts framework, and then add

#import <Bolts/Bolts.h>

到您的桥接头.

这为我解决了 Swift 中的一些缺失"API(这个 API 以及此处提到的 PFAnalytics.trackAppOpenedWithLaunchOptions:为什么我的 PFAnalytics 没有 trackAppOpeneWithLaunchOptions 功能?(IOS SWIFT)

This solved a few "missing" APIs in Swift for me (this one, as well as PFAnalytics.trackAppOpenedWithLaunchOptions mentioned here: Why does my PFAnalytics not have trackAppOpeneWithLaunchOptions function? (IOS SWIFT)

这篇关于PFObject 在 Xcode 6.0.1、Yosemite GM3 中没有名为“saveInBackground"的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 20:56