According to the docs here: https://www.parse.com/docs/ios_guide#files-progress/iOS
this is the suggested syntax for handling file save with a completion block and progressBlock.
let str = "Working at Parse is great!"
let data = str.dataUsingEncoding(NSUTF8StringEncoding)
let file = PFFile(name:"resume.txt", data:data)
file.saveInBackgroundWithBlock {
(succeeded: Bool!, error: NSError!) -> Void in
}, progressBlock: {
(percentDone: Int) -> Void in
}
However, Xcode 6.2 throws this error: Sequential statements in a line must be separated by a ';'
in this line:
}, progressBlock: {
Does anyone know how to use progressBlock correctly in this scenario?
Edit 1: Here is a sample in Obj C:
NSData *data = [@"Working at Parse is great!" dataUsingEncoding:NSUTF8StringEncoding];
PFFile *file = [PFFile fileWithName:@"resume.txt" data:data];
[file saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
} progressBlock:^(int percentDone) {
}];
Edit 2:
Another attempt, another error:

Edit 3: Source code, but with CInt to suggest comments

source
share