【发布时间】:2016-01-13 17:54:01
【问题描述】:
使用 Swift 2.1 (Xcode 7.2.) 和 Parse 1.12.0,我收到一个错误,即 PFObject.save() 在 Swift 中不可用。我的代码是:
let operation = NSBlockOperation { () -> Void in
do {
let success = try rating.save()
}
catch let er as NSError {
error = er
}
}
在PFObject+Synchronous.h中,有这样的:
///--------------------------------------
#pragma mark - Saving Objects
///--------------------------------------
/**
*Synchronously* saves the `PFObject`.
@return Returns whether the save succeeded.
*/
- (BOOL)save PF_SWIFT_UNAVAILABLE;
/**
*Synchronously* saves the `PFObject` and sets an error if it occurs.
@param error Pointer to an `NSError` that will be set if necessary.
@return Returns whether the save succeeded.
*/
- (BOOL)save:(NSError **)error;
所以 Xcode 似乎无法判断使用哪个函数:它应该尝试使用处理错误的函数。有没有办法强制这样做,还是我错误地调用了函数?
【问题讨论】:
标签: ios swift parse-platform